A complete REM cycle is usually around 90mins, and it takes about 30mins to start falling asleep deeply. For me personally, 7.5hrs is the perfect amount of sleep, which equates to 5 REM cycles.
Now, if you wake up in the middle of a cycle, you will usually feel groggy as your brain gets to grip with reality. Therefore, you want to aim to wake up just at the end of a cycle, ideally.
Try sleeping without an alarm, and make note of when you went to bed, and when you woke up. Hopefully, that time should be roughly divisible by 90mins, assuming nothing woke you up.
Knowing the above info, you can time your sleep better to ensure you don't set an alarm for mid-cycle. As the other commenter mentioned, there are also apps & devices that can help detect when you're coming out of REM and time the alarm based on that.
Lastly, if you do snooze after waking up, try "snoozing" for a full REM cycle (90mins), or try a power nap (<25mins). That might help "catch up" on sleep after you wake up.
I used to purposefully set my alarm 90mins before my actual wake up time, and then "snooze" for 90. That was mainly to induce lucid dreams though.