I sympathize with this Cole. I have always had vivid dreams that were more often of nor nightmares, and as a kid I would wake up on the floor or smack myself.
First off the scratching: I would be careful to keep my nails trimmed and not too long and keep them filed so that they are not sharp at all. If you can stand it, light socks and gloves may help. I can't sleep with anything on my hands and feet, so I would just go with the first part of this suggestion.
The Nightmares: Something I have found to work is to lay in bed and meditate before bed. At first I would visualize some of the things about the dreams that were scary but unrealistic. For example, I had one where I was eviscerated but had no pain and stayed alive. Understandably this freaked me out, but when I realized that this wasn't realistic, I was able to wake myself up. So I would focus on various parts of your dream that aren't realistic and visualize them to try and help you notice them in your dream. This also had the side effect of learning how to fly in some of my nightmares where I was deep asleep and couldn't wake up but now I can usually fly away and still be scared but make myself safer... weird I know, but it works.'
The other half of the meditation that I do, is to visualize nice and calming things. This is because if you stop with the scary visualization you are more likely to have a nightmare, and I would have a hard time falling asleep because I would anticipate it, which is unhelpful.
I lay there with my eyes close and imagine nice things. As a kid I would imagine that My Little Ponies were my friends and would protect me. Or I would visualize nice picnics in a flower filled field. This visualization would also help me calm down after waking up from a nightmare.
Over time this habit has become less of a nightly thing and now I just clear my mind before sleep and visualize nice things if I wake up from a nightmare.
I hope this makes sense and helps you.