Can a transistor be used to switch two loads with different voltages?
Yes, this will work if you change it slightly. Put a resistor and a diode (i.e. 1N4148) in series with the LED so it doesn't die from too much current or reverse voltage. Also put a free-wheeling diode across the relay to protect the transistor from voltage spikes.







simulate this circuit &ndash; Schematic created using CircuitLab

If your 5V load isn't a LED, you need at least the diode (D4) in series with it but not the resistor.