When we have an itch and we scratch that itch we're blocking the itching sensation.
When we scratch we cause pain and our nerve cells tell your brain that something is hurting and that distracts the brain from knowing about and feeling the itch even though the itch is still there.
Scratching can actually make the itch worse even though it's hard to not scratch.