How the hell do you cope with depression and anxiety?

I'm so tired of figuring out what the hell is wrong with me. Like why am I not disciplined. Why am I not taking accountability of my life and actively working for the future but I'm spending countless days and years living in the past not only is this hurting me mentally but is also making me feel stuck there.