Not Sure about Subs getting sunk by Artillery… But I remember in Vietnam, at the Battle of Khe Sanh, There were major problems with getting in any kind of air support.
The American Base at Khe Sanh was being so heavily shelled by Artillery, that incoming aircraft were almost garunteed to be struck down by regular artillery shells.
Let’s not forget that Artillery is very versatile, and that a common combat theme in WWII (which still applies today) was to be creative. Sometimes you just use what you gotta use to get the job done.