I had this too - twice. I fixed mine as of now.
I had this happen too - twice. Seems pressure on the screen somehow caused this to occur in both my situations. I didn't have a case on my phone in either instance and would rather just put it in my pocket. Since then I have bought a Cellet case and this problem hasn't returned. Seems that daily rituals like sitting down and getting up put some kind of pressure on the slider. The slider seemed to come askew and not glide properly on the rails. Almost slightly grating like. I could tell something was up because it was not buttery smooth like before. I hadn't dropped the unit either so it could only be where or how I was storing it.
Anyhow I was all set to take the unit in for repairs when out of desperation, I smacked the slider from open to closed quite forcefully and it fixed things - both times. I wouldn't exactly recommend you do the same for I don't want to be responsible for breaking your device or making it worse, but it DID work for me. I fixed mine as of now. Do so at your own risk!
Previous to this, I even tried reverting to previous factory OS versions and even upgrading the OS too. I even tried having NO apps on the unit in case it was something software related. It's not the apps, nor the OS...don't believe me? Waste a day of your life experimenting like I did and you'll come to the same conclusion. The poster above me has the right answer - it's the sensor. I don't exactly know where this is exactly nor if it's mechanical (switch like) or electronic but something is preventing it from triggering. I even tried to slide down a piece of thin paper behind the screen to see if I could figure it out and perhaps nudge it back in place - didn't really help.
There are all kinds of videos on YT that show disassembly of the phone if you're curious like I was:
It'll void your warranty if you do this yourself so it's best to call a local dealer and ask them where your city's repair center is located. It's just you'll be out your phone for an unknown amount of time...
Really that's your best solution - bite the bullet and if its under warranty still, you're in luck - have them fix it. If not, then try to unscrew things and pull it apart and reassemble it until you get it working. Just be extra careful and follow the directions very carefully for the cables in the device are paper thin.