You can’t set it to 5V because the ARM chips working on 3.3V. You need to use a transistor. The transistor will be controlled via your 3.3V GPIO pin and the transistor will drive 5v for your output.
Another option can be an operation amplifier or a voltage level shifter, depends on the application.