Toxic friend HELP ME PLEASE

Em

So I have a friend and he claims he has anger issues. He always gets mad if I don’t respond or leave him on read. He insults me then blames his problem and his anger issues. He calls me selfish, stupid and constantly tells me to “shut the fuck up” when I comment on him being mean. He also tells me to leave him alone and never talk to him ever again, which I have no problem doing but then he unsends the message and says “hey” like it never happened. I try to ignore him but he threatens me. He once said “ let’s play my game. Every time you don’t answer or leave me on read I’ll grab a piece of glass and cut myself ”. Then proceeded to text me a picture when I don’t answer within a couple of minutes. I don’t know how to make tell him to stop texting me with out getting him mad or making him self harm. He says no one understands him, and he has tried to commit suicide multiple times. He likes to text me late at night and and tells me something is wrong with him and he can’t explain it on text. He once did, and told me to delete the whole conversation. ( we communicate on Instagram ) Whenever he calls me he doesn’t tell me what is wrong with him but completely avoids the reason we called in the first place. He tells me when he does drugs on the phone and says the drugs make him talk to me like no one else. He says I’m the only one he has opened up to and that the drugs make him. I think he only talks to me because he has told me a lot about his problems. Should i put up with it for him? Or should I end the friendship? If I should how? Am I a bad friend for wanting the friendship to end? I need advice quick, because if he is left on delivered for a while he comments on it.