You seem really smart prollyadhd. Yes, there seems to be a link between depression and cognitive function. It's something that has gotten more and more study time in the past few years. Here is a little bit on it. https://www.health.harvard.edu/blog/sad-depression-affects-ability-think-201605069551 But this article is really excellent. https://www.npjournal.org/article/S1555-4155(18)30284-8/fulltext Are you diagnosed with depression?
I'm not sure I'd call it impaired cognition as much as it causes distraction and involves thinking thoughts we'd rather not be thinking. Now, whether or not you're depressed depends on your symptoms, how long you've been having them, whether or not something has happened recently that was very stressful that time might deal with, etc. If you feel like your life is being harmed by how you're feeling, therapy with a psychologist would be a step to take to get a diagnosis. More info on what exactly is going on might get better support here.