opposite sex or opposite gender? [duplicate]

They have different meanings.

'Sex' refers to physical attributes that often determine what role people are assigned at birth.

'Gender' refers to the cultural and social roles or functions individuals either are assigned or identify with.

Both idioms are factually wrong: sex is not binary, as some individuals are born intersex, meaning they have a variety of sex characteristics that "do not fit the typical definitions for male or female bodies" 1, and gender is not binary, since individuals can identify with genders other than male or female.

Of course, this might still be unnecessary perplexing for children, depending on the age and sociocultural context of those children.

Since 'gender' more often than 'sex' defines the role an individual identifies with, I suggest using that word, and exchanging 'opposite' for 'different'.

Lastly, assuming the sentence is an agree/disagree question, and the intended meaning is 'I treat them with as much respect as people treat me', the 'just as much as I do' seems wrong here. Currently, it seems to suggest that it means 'as much as I do treat people with respect', in which case someone logically has to agree (unless it's a philosophical rather than an ethical inquiry).

"People of different genders need to be treated with as much respect as I am"

Again, the grammatical structure mostly should depend on the targeted audience.