Wouldn't the distance measurement be only very approximate? It's not a transponder system, so the only clue is the "ping" strength.
The listening device has at least 2 detectors positioned very close together, but far enough apart that there is a time difference in receiving the reply signal. Using very clever signal processing, the distance and angle can be calculated, to within a few centimetres over a couple of kilometres.
IIRC sound travels about 3 times as fast in water as in air. I don't know all the theory and it would no doubt occupy a large amount of space to explain it all here.