Turn off PNP BJT with high impedance output
Even if you set the pin to high impedance, voltage on it must not exceed the maximum ratings in the datasheet, which is probably close to 3.3V. There could be an exception if the pin is labeled &quot;5V tolerant&quot;.
So if the base of your PNP is above that voltage, you'll need an extra transistor to control it.