STM32F072 3.3V on UART with Wi-Fi ESP 8226
Well, I think this is not a question for stack overflow. But I give my opinion anyway. I think you got it wrong. The STM32F072 does not work on a 5V power supply. The power supply must be below 3.6V. Most of the IOs are 5V tolerant, which means that if you apply 5V on them, it will not break the device.
So in your case, power the STM32 with a 3V3 power supply and its solves your issue!