Yes, it could. It is called "sleep panic". Please see below (maybe th 1st paragraph would be enough).
If you have XANAX, it might be better to take it before you go to bed.
Panic attacks are extremely distressing, but sleep panic attacks can be even more. Often, the person who experiences a panic attack while sleeping doesn’t know what has happened. He or she may wake up with a rapid heartbeat and a feeling of confusion or anxiety. A person may even wake up in the midst of a full-blown panic attack feeling fearful and afraid of dying or losing their sanity. Sleeping panic attacks can leave the individual feeling confused and distressed, and this may even develop into a fear of sleep.
Somewhere between 50% and 70% of people who have a panic disorder will also experience one or more sleep panic attacks. Episodes that occur during sleep are relatively rare, however, and account for only 10% of panic attacks. People who regularly experience these types of attacks are also more likely to experience other sleep disturbances, including insomnia and restless or broken sleep.
Sleep panic attacks can take more than one form, both of which can be very frightening. One of the ways that sleeping panic attacks can be experienced is that an individual will wake up feeling as though he or she about to have a panic attack. With a rapid heartbeat and racing pulse, the individual may feel confused, disoriented, anxious, and disconnected from reality.