It's a common observation that social media and screens have had a negative effect on people's attention spans. I've noticed related effects, such as Google and memory: why remember facts, when you can look them up instantly?1
The last few years I've been off most social media and I (mostly) don't pick up my phone for entertainment, but I still notice that my ability to focus on a long article (non-work, ie I'm reading for entertainment or self education) has diminished.
I blame the sheer amount of content! There's just so much to get through that there's always more in the queue, and anything that slows you down is discarded ("for later", perhaps). But as an early precursor, I also speculate that tabbed browsing had a big part to play here. My first introduction was the original iCab browser, and it was a revelation: pages loaded slowly in those days, so I could open a bunch in parallel and flick between them to consume those that loaded first. (Then of course you don't get around to finishing all of them so some are left for "later"… but I suspect that bad habit didn't fully develop until later)
I don't have any particular answers, but in addition to re-starting a mindfulness meditation practice I have been making a concerted effort to read more books again which I have been happy about.
This does actually work pretty well for me, as I have good contextual memory: I may not remember the details, but I do remember that it exists and I can recall enough of the context to enable me to find it again.