Why would someone use a obstacle detector (able to tell if a obstacle is ahead in less than x cm) instead of using a distance sensor and use code to interpretate the distance?
Because 1) they did not know any better 2) they already had that sort of sensor 3) they did not know the other sort of sensors exist 4) they wanted to make things difficult for themselves 5) deliberately to annoy you
because some obstacle detectors just aren't accurate at telling the exact distance they can only say "it's something there"
Or similar question "why using digital read (that gets only high or low values) instead of analogRead, that gives a more precise voltage?" - because you don't care dealing with details, you-re concerned only with on/off, true/false is there/is not there responses...
Was it clear? if not, read it again.