I believe there are Sonar bouys that are toed behind ships to detect submarines. These could be used, and I would guess that these are used to map the sea floor, but the sea is so flipping big that there are still unmapped areas. But I'm not an expert and would defer to an actual expert (or ChatGPT)
Passive sonar (where you just listen to acoustic energy in the water) is used by submarines and surface ships to find submarines. With both on-board and towed sonar.
Submarines don't have any sonar designed to map the sea floor, though there are tools to identify the depth below the keel at any given time. Creating proper maps of the sea floor are done by much more specialized equipment/systems/processes. https://en.wikipedia.org/wiki/National_Geospatial-Intelligen...