You need professional help. Postgraduate study is extremely tough on mental health, and I'm sure many people struggle with unhealthy coping mechanisms. You may be able to get free counselling through your university.
I went to see our university counsellor in my final undergrad year, and it was the best thing I could have done for myself, for my loved ones. I really encourage you to not fight this battle alone.
Good luck!