I hope you can figure out a way not to go down that route. It's not a good coping mechanism - it may make you feel better temporarily because of the endorphins, but the feeling doesn't last, trust me. And then you're likely left with some unsightly scars at some point because you will probably end up going too far with it, cutting too deep in times of great distress - even if you promised yourself you would stay in control and only cut 'a little'. Try to get those endorphins some other way if you can, like exercise. If you think you're suffering with depression or anxiety, please seek treatment from a doctor if you aren't already. I recommend speaking to a counsellor if possible too if this is something you've not already done - it really does help. Having somebody to talk to, who can listen, understand, and give you constructive advice... well, I've found it to be very healing.
Best wishes