There's certainly phycological possibilities (ADHD, Depression, Anxiety, etc). Certainly, all the changes to normalcy and near relentless repetition in life those changes have created due to COVID have messed up a bunch of us. Back in the day, if I needed to focus and do work, I would take my laptop or tablet to Starbucks and I'd be super productive. As we approach a year of COVID, I have just been much less productive for 12 months :(. There was something about that environment that I just wanted to work. I worked all over town, so in 2019, I frequented probably 15 different Starbucks locations.
Make sure your working environment suits you. Your chair is comfortable, you actually like the keyboard/monitor/laptop you are using. You are dressed to enhance your comfort from a temperature perspective. Use headphone if you need to drown out others. Or play rain or city sounds if it's too quiet. I have an ultrasonic humidifier/essential oil diffuser with different color lights on my desk ($15 on amazon)
Turn off social media notifications, or use the web interface instead of the app. Limit the number of platforms you use and limit the number/types of people you follow. Screw your cousin's friends in Florida that went to a party at a beach house when you're stuck in your 600sqft apartment in Seattle or San Jose or Austin. Envy/irritation from looking at others is counterproductive when you're trying to be productive.
A lot of people take up working out as a way to focus or help motivate themselves. There's a lot of natural processes that happen in your body that a walk or run or strength training can activate that have positive affects on your body and brain.
Get enough sleep. You need to get 7-8 hours regularly at a minimum to perform. If you are having trouble sleeping, don't have any caffeine 6-8 hours before bedtime. Make sure you have the temperature at a comfortable setting. Most people sleep better if it's a bit cooler. If you are waking up more than once at night, get an at home sleep test done. You may have sleep apnea. It's very common, especially among those with allergies or overweight, but even normal skinny people can have it. I've had a cpap now for 6 months or so, and most nights, I sleep the full 8 hours until my alarm goes off. They also have humidifiers and filters that make the air more pleasant to sleep with.
For the past few years, I was having more and more days where I was just lazy or tired or unfocussed or foggy. I was using coffee to help mitigate these days, but I realized it coincided with pollen/allergen counts/seasons. It got so bad, I started taking allergy shots a year ago. And, I really think this has helped me.
Find something that calms and re energizes you. I've had stressful days, and on my lunch break, i'll just watch 15 minutes of mindless tiktok videos. I can't tell you how relaxing I have found this to be.
This is probably not your answer, but sometimes, nothing beats a cup of coffee for my productivity. Just make sure it doesn't have a bunch of sugar and maybe only a small amount of cream.