Having trouble getting over ex after ending relationship

I broke up with my boyfriend of 3 and a half years just three weeks ago. I did it for what I felt were good reasons at the time; I found out that he had been using drugs behind my back (this also wasn't the first time he had done this). I still love him and I'm having a hard time getting over our relationship. I thought it would have gotten better by now but if anything it's only gotten worse and I have a constant urge to call or text him. When can I expect it to start to get easier and how do I fight this urge to contact him?