This may be a simple problem, a so-called hypnogogic (technically hypnopompic in this case) sleep
problem. Many people experience unusual neurologic phenomena transitioning from sleep to wake or wake to sleep.
However, with the limitations of this forum, it is impossible to determine whether a more dangerous neurologic problem is present. See your doctor for specific diagnosis.