Difference between Ultrasonic sensor and Distance Sensor?
An ultrasonic sensor can usually develop and receive high frequency sound waves.  They can be used to measure distance by measuring the time of flight of the sound wave.

distance(meters)  = [speed_of_sound(meters/second)][1] x time_of_flight(seconds)
distance(meters) = 343(meters/second) x time_of_flight(seconds)


For example, say the time of flight was 0.01 seconds.

distance(meters) = 343(meters/second) x 0.01(seconds)
distance = 3.43 meters


This is just one way distance can be measured by a processor.  Other ways use different types of radiation such as electromagnetic radio and light radiation.  Some of these use time of flight. Others use more exotic phase techniques.  These types of detectors can be very accurate over long distances.  But are usually very costly.  They are commonly used for automated car driving.

A completely different approach uses triangulation or parallax of a light beam and a focused linear array light sensor.


These types of detectors normally operate over short distances and are cheap to make.  They are commonly used in places like copier machine to detect objects and paper.  Or in automated vacuums cleaners to detect floor edges such as stair drop offs.