I get like that alot. It can be completely debilitating.
Mindfulness practices can help (when I am able to employ them)... distraction,self soothing, and redirecting outward / staying in the moment. These are coping skills I learned thru DBT. But there are many books, blogs, and articles on self help thru mindfulness. Also talking to a T or another trusted source about these memories and feelings can help to try to resolve past issues and gain self-esteem to be able to move forward.