Sex' and 'gender' are often used interchangeably, despite having different meanings.
Gender: socially-constructed roles, behaviours, expressions and identities of girls, women, boys, men and gender diverse people.
Sex: biological attributes of humans and animals, including physical features, chromosomes, gene expression, hormones and anatomy
This simple infographic from the Canadian Institutes of Health Research helps to explain the difference.