On occasion it's possible to experience brief, dreamlike sensory imagery and sensations just before or while falling asleep, or during or just after waking up. This is usually referred to as a hypnagogic hallucination. As long as it's not causing a major disruption or harm in your everyday life, it's normally nothing to worry about.