STM32 Has a toolchain that works (to some extent) out of the box. With ESP32 you either have to use ARDUINO which has no debug and IDE worse than notepad or spent significant time to build a toolchain based on Eclipse and some sdk from Espressif (still no debug capability).
Unless u need WiFi, go for STM32.
Most people have already highlighted the strength and weaknesses of each.
I just want to point out that with a <$10 FT2232L and Plaformio, you can do full HW debug on the ESP32, with a similar user experience as the STM32 (even using Arduino for the ESP32, or the native SDK). It uses SWD, and you can do just about anything, even if I prefer the Segger user experience on STM32 (which, depending on which board you use, might or might not be covered by the free license, even if there are quite a few "grey areas" uses of Segger and Segger on board working even on the cheap eBay ST Link clones, using a few tricks). But IDE and debugging is a complete draw, with no chip being better than the other in this respect
If you need BLE or WiFi, the ESP32 is massively convenient. If you read the documentation, you can run some pretty strict hard real time on the dual core even using Arduino. I managed
to read 3 I2C sensors over 2 I2C buses at 400kHz bus speed and send data via BLE 500 times a second. Just the I2C timing takes most of that timing window, and could do it only thanks to the dual core architecture and RTOS. It was not easy to figure everything out, but once I did, it worked reliably
If you need ADC/DAC, there are amazing STM32 chips (can do ADC at 10MSPS at 12bits), while the ESP32 is a sad joke when it comes to anything analog
On the other hand, if you want to build a drone/rover, with an ESP32 you don't even need a radio, there are plenty of examples of drones built with an ESP32 in the transmitter (or using a phone's wifi) and an ESP32 on the drone
I routinely use both, and I like both, as long as I use them according to their strength for a scenario