UltraSonic Sensor wirh ESP-01 Standalone
There are 2 things here.
Ultrasonic sensor works on 5V while ESP on 3.3V. So your sensor is sending 5V signal to ESP. It might fry your board but I believe it has a safety cut off of everything above 3.3V and that's the reason your application is not working.
Cheap solution would be adding voltage divider to your Echo pin:
https://randomnerdtutorials.com/how-to-level-shift-5v-to-3-3v/
but then you will face the issue mentioned by Juraj above.
You may then overpass that issue manually or look for more sophisticated (expensive) solution.