How can I get my motivation and focus back?

I have lost my motivation for everything. I just can’t motivate myself to do things that are important to me. I spend time thinking about it, worrying about it and getting anxious. I have lost my presence of mind also.
So many times, it feels like I just am not listening to the other person, even though I want to. It’s not like getting distracted. This is different. Sometimes I don’t even realize what I am thinking in the background while the other person is talking. I am just not there.
Another thing is I tend to have a lot of energy some days and none at some. Somedays I feel like I can do anything and I do all the work. Then again, I am drained of it the other day and for several days all I can bring myself to do is to lie down, think, overthink. I don’t know!
I have lost so much of my focus, my awareness, my memory. I have lost all the confidence in me. I don’t feel like talking. Things that used to come to me naturally, like writing or ideas or just analyzing a problem, are just lost. I feel I was way smarter before. Please tell me what has happened. Everyday I am scared something is happening to me. I fear I will not be able to reach my goals. I feel devastated this way. It’s so often like I am punishing myself even though I don’t want to. (Note: I am a 27-year-old female.)