First you need to list all features you want. Comms, GPIO amount, PWM (max frequency, additional features you might need like dead time), ADC, etc.
ESP32 have something unique - wifi, and it has mostly all features that regular MCU have. But ADC in it sucks big time (25Ksps vs 1Msps on normal MCU), maybe some other things too, especially amount of available GPIO.
Also each STM32 model is different.
You can keep using arduino with both, but try to pick more serious tools if your project become more than hobby.