This isn't a case of sleep apnea.
Sleep apnea sufferers aren't aware about their arousals during sleep.
They are informed about that by their bed partners (although, sleep apnea contributes to experiencing panic attacks during night sleep).
Your episodes of symptoms before falling asleep and when waking up during sleep are suggestive for panic attacks.