Why is my Sony experia Z1 compact acting strange?

A

AC Question

Okay so I got this phone in 2014 and up until now I've had no problems but now when I insert my headphones it's acting so weird. Like it lowers and highers the volume without touching the volume button. It opens and closes apps and I'm getting really annoyed. I've tried resetting my phone but it's not working.