Is sex male/female and gender "what I identify as"? I've always thought of them in this context as meaning the same thing...
That aside, yes, “sex” broadly refers to biology in some way, though often oversimplified, while “gender” refers to identity and expression (which also don’t necessarily go hand in hand).
But in other settings they are usually conflated.