To expand a bit on
@Azzyasi , it depends on your application.
@Azzyasi describes the situation of powering the RPi. I have experienced problems with my RPi3B+ when the supply voltage drops to 4.7V. Considering I have a 5V supply @ 3A the resistance of the wire must be less than (5-4.7)/3 or 0.1 Ω. (Vs - Vpi)/(Is). The voltage drop is also called "IR drop" or "IR loss"
With that information you search "what is the resistance of [X]AWG wire?" Often times this is in Ohms per 1000'. Then you need to know the length of the wire you will use. The result will be the size of the smallest wire you can use.
If you're trying to drive a device, read the specs on the device which will have a maximum input current (I'll call Id). (This must be less than the maximum current the GPIO pin can source.) Your device will also have a minimum "on" voltage (I'll call Vo). Search for the output voltage of the RPi GPIO pin (I'll call Vg). So the maximum resistance of the wire is (Vg-Vo)/Id. Knowing the length of your wire run will allow you to calculate the appropriate size wire.
Don't forget that connectors, too, add to IR loss.
I'll that said, I've used wires from 20AWG to 30 AWG.
One final tip, long wires, sometimes as short as a few centimeters, act as antenna and will pickup RF "noise" which causes unintended results. But that's another very long discussion. (I've used CAT5 cable of 30cms to connect up an nRF24 radio, which is very sensitive to noise, with success)