What is the correct of operations for powering analog sensors from digital pins

If I was driving a mosfet/BJT from the pin, it sounds like that 'slightly-high" but not really high, situation could cause some weird results?

So I will stick with pinmode output ->digital write to enable a power supplying pin

and

digital write low -> pinmode input to turn off the pins

as the correct order