Google Maritime Strike Tomahawk Cruise Missile. It has a range of over 1,000 miles and can target ships.
Eh, Tomahawks are not fast missiles. They move at about normal jet aircraft speed, and are thus vulnerable to most of those same weapons. Its not easy to stop all of them, you have issues of "the bomber will get through", but heavily attritionable: I remember watching someone play through one of those navy sims which stives for realism protecting a Chinese air base against, I think it was a 100 cruise missile swarm directed against an airport narratively being used against Taiwan.
I recall it requiring a AWAC aircraft to pick up the missiles on radar and successfully target, then mobilize 10 fighters to intercept, which killed something like 20-30 missiles (one on the first pass, then had to turn around and chase down the remaining, getting another or two (which then suffered heavy casualties as there were fighters launched to intercept the fighters after the first pass, forcing them to either stay and engage in a combat they weren't prepared for, or try to keep chasing the missiles with fighters on their tail). After the fighters the missiles overflew the fleet, which shot I think 2 counter missiles per missile, which got another 30 of them. Then he had some last couple of fighters he could scramble from somewhere else, maybe one was a helicopter, which killed another 10. Then another 5-10 were destroyed by the final line of AA guns at the airfield directly, with I think it was something like 10 hits, 5 of them doing serious damage.
So, that does help highlight how difficult stopping a missile volley really is, but does show it is degradable. And even getting all the missiles through, making sure the missiles actually do something is fairly difficult. Especially with the more warning a target has to take measures. A ship in harbor with damage control crews mobilized and firefighters at the ready if it gets hit by a half ton bomb and all hatches closed in combat readiness has a very different survival profile vs a ship with the crew all away on weekend leave. And a half ton of explosives in not a whole lot in terms of anti ship weapondry. It definitely hurts a whole lot, but ships can survive a surprising amount of hurt.
So, while a Virginia sub might have 30 Tomahawks that can theoretically destroy 30 ships, more likely that's probably closer to 3 hits, maybe one damaged ship and 1 destroyed ship. And well, if its a single Virginia attacking a naval base with more than 30 aircraft available to intercept, its quite possible nothing gets through. And once it expends all its missiles, well, its 10,000 km back to the US, which should take about 10 days at its listed speed.
Assumedly, it will have closer bases, but, well, that puts it at the mercy of the broader Air and Naval war, and puts itself at more risk of being destroyed itself. Depending how broad the war is.