It's called a Time of Flight (ToF) sensor, and operates the same as the older ultrasonic sensors, except with infrared wavelengths of light. Emits a pulse and measures the return time of the reflection. This can be converted to a distance measurement to whatever is below.
It's more accurate and has greater range than the ultrasonic sensors, and why DJI switched to them some years ago.