ESP32 + a 1.5 km laser rangefinder module: serial reader and MQTT publisher (LR1500E2)
If you want a distance sensor that reaches past 1 km and talks to a microcontroller over a plain UART, a bare laser rangefinder module is the right class of part. This post shows a complete ESP32 sket