Yes, you can absolutely set voltage with a potentiometer, if that potentiometer is part of a safe adjustable AC- or DC-DC converter that supports to be set by a resistor.
Since you probably are rather speaking of something like a voltage divider: That just goes back to septillion's answer: You don't know what you do and you are going to kill yourself.
Why is that dangerous?
Because AC acts on your neuronal system, which can mess up your heart rate. Or contract your muscles to a point that your bones break. Just as examples. It might also burn you directly - or indirectly, after it set your place of living on fire while you sleep.
Get a 24V power supply (5-12V is also fine, but 24V leaves you more options for playing in the safe range, if you want to play) and an MP1584 DC-DC converter module.