There's lot of confusion among laypeople, and even among scentists, about what "sex" is, in the sense of "what do we mean by a biological sex?" This goes along with questions like "Is sex binary?", "How many sexes are there?" and so on.
For a scientific but accessible discussion of how biologists construe sex, the article below from Aeon (click on screenshot) is quite good.
What do biologists mean by "the sexes" of an animal or plant?
Why do we have sexes in the first place? Why doesn't everything just reproduce asexually by budding or parthenogenesis (production of an offspring from an unfertilized egg)?
Why are there only two sexes in the vast majority of animal species? Why can't there be three or more sexes?
Are hermaphrodites or developmental anomalies members of other sexes?
Why do biologists define the sexes by gamete size rather than by chromosomal constitution or characters like sexual organs?
Why doesn't the existence of individuals with combinations of male and female traits prove that sex is a continuum?
Why we can't necessarily extend biologists' views of sex to questions like "who participates in women's sports?" or "who goes to a women's prison?"
I have a few minor quibbles with the piece, but they're so trivial that they're not worth mentioning. What especially interested me was the evolutionary question. Biologists have long wondered "Why did sexual reproduction evolve in the first place?", and, truth be told, we don't have an answer everyone agrees on. There is more agreement on why there are just two sexes in the vast majority of animals, although some organisms like protists have dozens of "mating types" that might be seen as sexes (Griffiths doesn't).
Have a read of the piece if you want to be informed about biological sex before you wade into the gender wars.
Nice subject