It's not OK, but will probably survive for some time.
In principle for the LED it works: if you pull GPIO low, the resistor+LED has a good current path to GND and will conduct normally. However if the GPIO is driven high, assume the GPIO is at 3.3V. The resistor+LED is connected to 5V. Although the voltage drop across the LED may be say 2V, this is only at a
reasonably large current of say mA's.
If the current is much less (say 50uA), then maybe the LED will only drop e.g. 1V. It's not an Ohm's law equation, but rather some exponential form, but the point is, some current will still go into the ESP32. The question is: is there somewhere for this current to go to? Well probably yes.. as the GPIO connects to the 3.3V (or otherwise through ESD diodes if the GPIO is an input), the ESP32 can "sink" this current to the 3.3V rail. Since the ESP32 in normal run mode consumes several mA, this small current leaking would mean the voltage regulator of the 3.3V rail would need to supply a bit less current (it's offset). This would not create any crazy voltages at the ESP32 chip itself that my destroy it. I bet if you measure the voltage at the GPIO set to 'high' it's still 3.3V, but I assume if you measure the voltage drop across the 100R resistor it may have some voltage drop (in mV's).
The problem with this configuration is when the ESP32 goes into sleep. If the ESP32 is in deepsleep consuming single-digit uA's, then this e.g. 50uA leaking to 3.3V will be enough to pull up that rail to a higher potential. A too high voltage will degrade the part over time. Voltage regulators may also not like it to see their output being lifted up. Worst of all: the ESP32 has a chance to enter a latch-up condition on power up, which can destroy the chip.
https://www.ti.com/lit/wp/scaa124/scaa124.pdfSome MCUs have 5V tolerant I/O pins, but these only work for input or open-collector/drain mode. And there are no ESD protection diodes present. Those would be OK to use for this purpose, but otherwise, please don't
![Smiley :)](https://www.eevblog.com/forum/Smileys/default/xsmiley.gif.pagespeed.ic.R8GFI-pF6f.png)
It's better to get a 5ct FET and switch the LED like that.