How is Hormone Replacement therapy

how is Hormone Replacement therapy a risk factor for endometrial Cancer, but OCP’s are protective? Aren’t they both made up of Estrogen and Progesterone?

HRT - the only estrogen hrt is a risk for endometrial cancer not E and P contains HRT

thank you sir