I installed elementary os onto a usb using legacy settings, and I can boot it using legacy bios options. However, I would like to switch the boot to UEFI so that I dont have to change my PC's firmware setting everytime I want to boot windows from my hard drive, or switch it again when I want to boot elementary off the USB. Is this possible, and how would I go about doing it?
If a live or persistent live system
@C.S.Cameron's comments are relevant.
Save the casper-rw file or the content of the casper-rw partition.
The method he is describing is explained with more details at the following link,
If you want a persistent live system with a casper-rw partition, you can use mkusb to create it from the same Ubuntu iso file as the previous one. Then the content of the old casper-rw partition will work.
If an installed system (installed like into an internal drive)
It is possible to convert the boot mode from BIOS (alias legacy) mode to UEFI according to this link (as suggested by @MichaelBay in the comment to your question),
An alternative (for other users, who read this in the future) is to create an installed system (or modify your current system) such that it can boot both in UEFI mode and BIOS mode. See the following link,
This way you make a system, that is portable between newer and older computers.