Dissociation is a state in which a person feels that the world around them is different or may have out-of-body experiences, such as feeling as though you are watching a movie of yourself. There may be associated memory loss of certain times, people or events.
This could be because of extreme stress and can also be symptom of Depression , Anxiety, sexual abuse or Post traumatic disorder.
Getting lost in thoughts is basically thinking too much or worrying about something, which makes it seem that you are not attentive to things happening around you.
Anyone can have dissociation in extreme stressful situations as it is the body's defence mechanism of coping with such events.
Dissociative disorder needs treatment of the underlying problem either Depression or anxiety etc. Medication may be given temporarily, but counseling would be the mainstay of the treatment plan.
Hope this helps, All the Best!