Generally speaking, a smaller space such as a carrier is considered to be safer whilst you are in transit as there is less space for a hamster to be thrown around in if you have to brake sharply and less to fall on top of a hamster.
If I'm transporting just one hamster, I'll often use something like this:
https://www.amazon.co.uk/Ferplast-Al.../dp/B00F5ZYR72
It's sold as a Guinea Pig Carrier but it's much too small for a guinea pig but is a good size for hamsters. I usually put some used substrate from the cage in with a tissue box or something for the hamster to make a nest in plus some food and some large chunks of cucumber for moisture. I usually take a large fabric bag for life with me that I can just pop the carrier into if we go into a service station too so I'm not leaving a hamster in the car that may get too hot or cold.