They are different, because a man can identify as a woman while being biologically a man.
A woman can identify as a man while being biologically a woman.
It's simple, really.
Gender relates to identity, sex relates to biology.
They are different concepts.
This is a modern linguistic switcheroo, and we have the receipts to call you out. Decent people have said "gender" to be 'polite' and not say the word "sex". This was a mistake, as the gender critical activists have attempted to gaslight everyone by changing the commonly used meaning of a word. Yeah, "gender" was always a made-up concept, but even more so in the way you people use it.