Despite its cosmopolitan vibe, Dubai is part of a country with Islamic values, so it is essential to dress as per the social norms. It is better to keep shoulders and knees covered when in public places like malls.
Shorts and sleeveless clothes are permissible at major tourist sites and in the dune bashing spots. Swimwear is fine around the beach and pool and in the modern villas in Dubai.
Dubai is the most liberal amongst all Emirates, still, it is sounder to avoid clothes that bring about unwarranted attention.
One must take off footwear before going into a mosque or home of locals. It is also customary to offer and accept money, food, gifts with your right hand. Also, photographing locals without their consent is believed to be a sign of rudeness.