You didn't specify your load current requirements. This is a critical piece of information to select a proper transistor to switch your load. Once you learn what your load is, here's a rough guide to transistor selection for the RPi:
Low-side Switching - 0-24 VDC, 0-100mA:
simulate this circuit – Schematic created using CircuitLab
MCP23017 is an I2C I/O expander.
According to datasheet VDD, supply voltage goes from 1.8 to 5.5V while VSS is ground.
So it would be possible to run those chips at both 3.3V and 5V both have pros and cons.
Running at 5V
PRO: feeds directly from the (powerful) +5V rail
CON: you will need to level-shift your I2C (for I2C open drain it's just a matter of ...