Gender is not synonymous with sex. Gender refers to a person’s social identity, while sex refers to biological characteristics. Not all people fall under one of two categories for sex or gender, according to leading medical organizations, so avoid references to both, either, or opposite sexes or genders as a way to encompass all people.
(Source: AP Stylebook)