Yeah mate,
UAE is 1 country, if you got the entry visa for it, you can visit and exit any city you want, theres no borders or anything like that. just drive through sheikh zayed road :)

dubai to sharjah is pretty close 20 min drive (if no traffic) with rush hour traffic it can take upto an hour.

dubai to abudhabi is like an hour and thirty minutes drive

pm me if you ever need any more info regarding dubai