Iphone side button not working?

My side button is not working (the lever thingy) now i don't know if its on silent or not. When i put my earphone in it works and sometimes out of the blue. The logo comes on the screen telling its on ringer. But apart from that my earphone jack is clean but not like mad clean. I compared mine and my muma iphone jack and hers is so dirty. And hers still works! I'm starting to panic what shall i do

Don't panic, if yours is still under warranty, you can give it back to Apple, but if you've had it for over a year or past the warranty period, you'll just have to put up with it, or get a new iPhone. I don't think cleaning it or formatting your iPhone would help, but if it's bothering you that much, it's worth a shot.