Ultrasonic sensors can be used to measure distance, but if you assume the speed of sound is constant like I did you’ll be sorely mistaken.
The actual speed of sound depends on both temperature and humidity so you have to compensate for both or your measurements will be inaccurate.
https://www.engineeringtoolbox.com/amp/air-speed-sound-d_603.html