Loss of motivation to do either academia or industry. Wasting days and feeling lost. Any advice? I have submitted my STEM PhD thesis to the committee. If everything goes well, my defense will be done by the end of the year. I published 2 papers during my 5 years of PhD, few more to be submitted. 

I had applied to few industrial positions a while back, got rejections. 
I am feeling unmotivated and lost now. I don't feel like searching for postdoc or industrial positions. I am 31 years old.

I have few pending projects that I should be doing, but I am feeling hopeless and dumb. I am taking this time to study and revise the theoretical concepts from my masters and undergraduate. I should be honing my programming skills. But the more I study, more I am feeling incompetent and lost.

I am literally wasting my time. It's already been over a month since I have not worked. I have just edited my manuscripts, watched some MOOCs. I watch movies or just sleep most of the day. I feel uncertain and uncomfortable about my future. Any advice for me?
Sounds like burn out. Take a vacation. Do something fun and not work.

These sorts of feelings are pretty common for someone completing an advanced degree. But in most cases the feeling doesn't last unless you continue to add stress. 

In many cases it is worth seeing a counselor. 

But your current activities are probably too related to work to allow for stress reduction.