well, you just slide down the notification centre, and see there if you see rotation lock. if you don't see it, press expand. turn the rotation lock off.
you can reach this setting also by going to settings>system>display. turn it off. device display will rotate according to the way it is held. if it is on, it will be stuck to the way it is.
and if you mean like the sensor within the phone, the hardware, then yes, it may be broken, as you cannot enable or disable it.
still, I would suggest you to do a soft reset. you do that by pressing and holding power button and volume down button together for around 10-13 seconds till it vibrates and restarts. this should do it.
also, check for software updates on your phone.
are you an insider? lemme know that as well.
hope this solves your problems.
good day.
