Don't try to stop - IF, and only if, you commit to two rules: First, have a pre-injury distraction routine: something immersive, like a puzzle, colouring in a colouring book, video game, a long shower, repairing something, weeding, swimming a number of laps, 50 push ups. Second, have a pre injury sanitation ritual, to ensure you do it responsibly (sanitize razors, cleanse skin, etc.)
The point is to distract yourself, but to take away the sting of of overtly denying the impulse. You might find that the urge to self harm declines, even subtly. Notice that. And don't do it anyway.