Sex is rooted in reality, but the boundaries are socially constructed.
Similarly, Pluto is no longer a planet because "planet" is a socially constructed category. It doesn't mean that it's not rooted in tangible, factual reality, just that we culturally decide what characteristics are required to fall into the categories we created.
pretending that biology/science exists without the social constructs or biases is a fool's errand. sex is as much of a real thing as the concept of species, its a generalized idea of something that cant be easily divided or distinguished based on really anything. its made to fit the social construct we already had, science didnt sprung out in an unbiased form and has not grown out of it. the distinction is flawed and done sometimes for ease and sanity; but a lot of times because of bias
Sex and gender aren't the same thing though. They are different concepts. I mean I am a trans woman, I identify as and largely appear to be a woman, but my biology and how I was born is physically male. This doesn't make me any less of a woman though.
It's actually really simple. See... unpacks a pile of books of advanced biology and genetics
Although... gets another pile of books about psychology and neurology
And we have to consider... drops another pile of books about sociology and anthropology.
Pretty obvious, isn't it?