Basically sex: "it has a dick it must be male"
Gender: "it moves like a girl acts like a girl, sounds like a girl so it must be a girl"
(Oversimplified example but basically sex is your jiggly bits and gender is what you believe you are or how you believe you should act usually based on how your sex and how people expect your sex to behave but you can technically be have how you wish)
Gender: What you identify as, sex doesn't impact it.
Gender: "it moves like a girl acts like a girl, sounds like a girl so it must be a girl"
(Oversimplified example but basically sex is your jiggly bits and gender is what you believe you are or how you believe you should act usually based on how your sex and how people expect your sex to behave but you can technically be have how you wish)