unconscious itching at night?

It doesn’t matter what kind of dream im even having, lately i’ve been sleeping and i’ll wake up in the middle of the night with my hands down my pants straight up scratching myself. I had to cut my nails super short because the first time I ended up cutting myself a bit and it just left me in pain for a while. Is there something wrong with me? I don’t itch during the day or anything. Last time I did it was two days ago and my vagina now constantly hurts bc I still managed to irritate my labia major and such. I saw an OBGYN (for other reasons) and she noticed it but didn’t say much about it.

Is there anything I can do to prevent this? or at least to help w the inner cuts and the irritation?