If you had to choose, you'd probably have less trouble for being trans than for being gay in Iran.
Due to this fatwa, issued in 1987, transgender women in Iran have been able to live as women until they can afford surgery, have surgical reassignment, have their birth certificates and all official documents issued to them in their new gender, and marry men.[12]
Still a shithole of a place to be in if you don't feel well conforming to the country's religious expectations, of course, just that Iran especifically is a rare case where being gay brings far more legal trouble.
I once met a woman who had the absolute shit luck to be born a trans lesbian in iran. She was fortunate enough to find a way to America, but we talked about the differences in transitioning here vs there and it was definitely wild. She was amazed that I was able to safely transition at my own pace while in college instead of dedicating the whole of my time to trying to pass as fast as possible.
Though let’s be real, being anything other than a cishet man in Iran is shit luck, and even they aren’t doing great either