I lived for six years in Dubai as a western expat. Dubai seems very "modernised" but the law is still sharia, and if they want to come down on you like a tonne of bricks, they can and they will.
It's always much tougher for South and East Asian migrant workers who are treated like slaves. Westerners do get an easier experience, kind of like expats in Jeddah on compounds where life can be pretty "free" compared to the streets of Riyadh.
In Dubai a lot of westerners took stupid risks, like drugs and so on. Basically if recreational drugs is part of your lifestyle, a posting in the Gulf is not for you. Likewise if you're an alcoholic, or someone of Muslim heritage who drinks (Muslims will get prosecuted in certain situations for alcohol whereas westerners won't).
You could get away with living with a partner unmarried, but you needed to keep the bills and rent in one person's name, and live discreetly. Most landlords will turn a blind eye but if neighbours complain, they're obliged to act.
The main issue is getting raped, particularly by a local. If you are sexually assaulted by an Emirati, just leave the country. Cut your losses, get the medical help and counselling you need in your home country, but don't bother pursuing it. Because the perpetrators will almost certainly get off scot free and you (as a woman) may get imprisoned for sex before marriage. As a raped man it may even be worse if you got charged with homosexuality, even if you were straight.
Always remember that it's one rule for locals and one rule for expats, and literally no one – the UAE or your own government – gives a shit about you if you're Chinese or Indian.