We were doing som A/S mortar firings as part of operational work up back in the 1970’s,
Sytem was pretty old fashioned even then, you shoot three mortar rounds from the launcher on the stern, these fly over the top pf the masts and all and land in the sea front of the ship, at ranges from around 400 yards to about 1000 yards.
Each projectile weighed about 400lbs- so thats 1200 lbs of get the fuck outa my ocean being launched in every salvo.
Whenever you have live firings, you have clear fire safety zones - we had a sub that had encroached on the edge of the zone, it was also doing operational work up, but it should have been further away - the shockwave of our mortars took paint off the inside of the sub, which was well over a mile away, I really really would not want to be in a sub with these things exploding anywhere within 100yards.
The problem with the tv and film shows is that the true ranges of weapons does not make for good looking action pictures, the depth charge that is part of the film makers mock up which explodes almost next to the sub would certainly destroy it, a depth charge within 50 yards would probably sink it, I am willing to bet that 1200 pounds of bang in an incompressible medium would kill a sub, folk do not understand the sheer power of maritime weapons, nor the scale of space that is a major component of maritime warfare.
A/S torpedos are small compared to anti shipping torpedos which can be 32 feet long, those A/S torps do not need to be big and they do not need to make direct contact either.
Gaining depth does add another dimension of uncertainty to any attack solution, this is a 3 dimensional war, a sub can travel away in any direction and at any operational depth all f which makes it harder to find.
The attack range og the sub will place it a good distance from a surface vessel, 5 miles or more if needed, by the time short range weapons such as depth charges and mortars are able to engage, the sub will have an opportunity to make off - it takes some time for an a/s vessel to put itself into position, especially with a plethora of dodgy contacts that usually need to be eliminated.