In TOS era (incl on Enterprise in movie 11), yellow=command/tactical, blue=science/medical, red=engineering/security/comms/misc support
In movie 11 we also see medical using white
Early Starfleet (Archer's Enterprise) used yellow, red, and blue piping on dark colored uniforms, according to pretty much the same scheme
In TNG era (includes DS9, Voyager) command/tactical use red, and eng/sec/comms/etc use yellow. Science keeps blue, but medical uses green.
Lookup: "Starfleet uniform" in Memory Alpha.