When you unload, keep the muzzle pointed downrange throughout the process. Try to have a part of your mental focus on muzzle direction awareness during every second of handling the firearm. If that means you have to turn your body to rack the slide, then DO IT! Do not start letting the muzzle get sideways, or vertical. (Once the cylinder is swung out on a revolver, nobody minds if you orient the barrel upward, to let dirt fall out of the cylinder along with the brass. Same with muzzle-down during loading.)
Okay, you are starting to unload. Get the magazine out, put it in a pocket. If you happen to drop the mag, let it hit the ground and then forget about it for the moment, you still have a round in the chamber. I have seen too many people start to stoop down worried about the magazine, and "forget" they've still got a loaded gun their hand. Muzzle direction awareness is discarded because of the dang magazine. Stop that!
Now, it's time to get the round out of the semi-auto chamber: Are you going to try to "catch" the round as the extractor frees it? That's your call, but only if you can do it without letting your support hand interfere with the process. Once in a great while that shoves the primer right into the ejector, causing a KABOOM. (I have been witness to it three times in 30+ years.) The round being detonated right then and there isn't fatal, but your support hand will never forgive you for the powder burns and little pieces of shrapnel that result. (Neither will the range safety officer, if you shrapnel
At about this same point in the process, revolver shooters would be getting some mixture of loaded rounds and empty cartridges out of their guns. Catch those five or more objects in your support hand if you wish, but don't then try to sort them into nearby receptacles, you also still have a firearm in your strong hand. Put them in a pocket or something, for the time being.
Okay, so the range officer determines your firearm is empty and you are told to close the action, snap the trigger DOWNRANGE, and holster. When the range safety officer tell you that, don't point the muzzle a few feet downrange, but rather at the backstop. That's what it's there for. And after that, promptly but with proper care, do so. Make sure the gun is in its holster as far as it's supposed to be.
I guess I should add, these unloading/handling tips should be heeded during any and all "trigger time", whether you're by yourself plinking or at some kind of event.