From 24V to 5V DC voltage regulator

You should use something like this

Have read here that current Uno regulators don't like being reverse biased. No first hand knowledge of that myself.
Perhaps get a 7.5V output, 9V, somewhere in there, and supply the barrel jack or the Vin header pin.