Something that has been very much a problem ever since the introduction of submarines, and to a similar extent aircraft. The victors can’t really know if they are no longer in any imminent threat. There could be submarines, real or imagined, around at any time. For example, in the aftermath of The Naval Battle of Guadalcanal, the damaged US ships retreating from the battle were attacked by I-26 which torpedoed and sank the damaged USS Juneau, which the remaining ships left behind without searching for survivors both out of fear of further submarine attack and the mistaken belief that she had gone down with all hands due to the size of the explosion.
Worth noting is that killing the survivors of sunken enemy ships was common practice on both sides in the Pacific Theater during WWII. In the aftermath of the same battle, from Samuel Elliot Morrison’s History of US Naval Operations in World War II, volume 5:
On board Atlanta all efforts were concentrated on saving the ship. Captain Jenkins, wounded painfully in the foot, urged his bedraggled seamen to superhuman efforts… Even after 0939, when the tug Bobolink had taken her in tow, Atlanta shot at a Japanese “Betty” [bomber] which ventured too close; the seamen of Bobolink, rendered bloodthirsty by previous experiences, machine-gunned every dark head they saw afloat until Captain Jenkins begged them to desist lest mistakes be made.
More in an older thread about shooting at pilots bailing out here

Believe it or not, during the earlier part of world War II, some U-boats rescued survivors of ships they sank. Then the Laconia incident happened, and that ceased.
The Laconia incident was very, very, very, very much the exception, and the wiki article is extremely poorly written. The only reason U-156 did what she did was because of the vast numbers of floating survivors and the fact that many of them were Italian POWs. U-boats did not attempt to rescue survivors with even the remotest of regularity, and the idea that U-156 was operating ‘partly’ under the dictates of old prize rules is, if you’ll pardon my French, utter horseshit, as is the claim that the Laconia incident “ushered in” unrestricted submarine warfare.
Old prize rules would have dictated that U-156 surface and demand Laconia stop prior to attacking and sinking her, at which point she could send a boarding party over to determine if she was carrying war materials. She would then have to allow the crew to abandon ship and would have undertaken the requirement to provide some assurance of safety to the crew before sinking her. That is not what she did. She was operating under the lack of rules of unrestricted submarine warfare, as were all submarines by all belligerents during WWII from the very outset of the war. She sank Laconia from ambush, and had there not been such a massive amount of floating Italian POWs, she would have left the crew to their fate, just like every other ship torpedoed by a U-boat or submarine in general during WWII.
For just how horseshit the claim in the wiki article is about the incident “ushering in unrestricted submarine warfare for the remainder of the war,” one need only look at the wiki link on unrestricted submarine warfare in the very sentence of the article:
Unrestricted submarine warfare is a type of naval warfare in which submarines sink merchant ships such as freighters and tankers without warning. The use of unrestricted submarine warfare has had significant impacts on international relations in regards to both the First World War and the Second World War. Its history has been dominated by German decision making.
There have been attempts to limit the use of unrestricted naval warfare, with some dating back to before the turn of the 20th Century as an extension of rules for surface raiders. While initially submarines operated successfully by attacking on the surface using deck guns, attacking without warning while submerged reduces the opportunity for the target to escape or defend itself if armed.
Attacking and sinking the Laconia without warning while submerged is exactly what U-156 did. The harsh reality is that submarines had to conduct unrestricted submarine warfare if they were to have any success. Again, operating under old prize rules U-156 would have had to surface and demand Laconia stop, which would have instantly resulted in Laconia broadcasting said information over her radio. Then U-156 would have had to send a boarding party over to determine if war materials were being carried, and either taken her as a prize (an impossibility due to the small size of a submarine crew) or allowed the crew to abandon ship and ensure that there were sufficient lifeboats, fresh water, etc. for them prior to sinking her. Old prize rules written for the age of sail and prior to the invention of (proper) submarines, torpedoes, or radios don’t mix with said inventions.