what do I do

This boy has been in my life for 3 years, in which we've mostly retained an on/off "thing", mainly in snapchat.He had cheated on my best friend at the time with me( I didn't know), and has cheated on multiple others. I know he has bad commitment issues due to his ex, and understand them. He started if very sweet, but then it went downhill. He started making me paranoid, and made me compete for his attention. I completely understand this boy is toxic to me. He is most likely one of the reasons for my lack of confidence and trust and my horrible self body image. But he is also one of the only guys who can make me feel confident about myself. But when we aren't together, I find myself going crazy, obsessing over little things and being petty towards him and anybody involved with him. I also get depressed, and don't know what to do with myself. What do I do?!?!?