It's totally salvagable, but you will need to really focus (easier said than done lmao).
In my first year what motivated me was to get into post. CS post of all the posts, notorious for being good at sucking your soul into it. I began procrasting so hard around midterm week and was like 3-4 weeks behind on two of the required courses. Assignment deadlines are piling up, exam nearing. And like I always did, I sought alternatives. One of the apparent alternatives, at that time, was this thing called second chance, which asks you to do super good in a bunch of b-level courses -- courses you are not guaranteed to be able to even enroll in, because well you are not in the post??? and failing the first chance means you dont meet the gpa prereq??? It took me an afternoon to realize there is practically no way around. And that became my motivation. I don't work my ass off, I'll end up in stats or math major or transfer (no offense intended! these options are certainly not inferior, I just didn't like them at the time. stats retrospectively is very cool too), non of which I wanted to happen. I kept implying to myself that it's do or die and obviousily I didn't want to die.
I don't know your exact situation and I'm in no position to really comment. But what I believe to be the most important thing is to find a motivation to do more work, one that's not simply "high gpa good, low gpa im doomed". Also try the mental health helplines. It's an issue ppl need to treat seriously. Ask yourself if you are facing mental health issues, just deceiveing yourself with 'nah im fine' is often not enough.
besides - go to lectures! being there and taking notes is a totally different thing than sitting at your laptop and watching the recordings. I often get distracted so much that it takes 2hrs to watch a 2hr lecture at 1.4x speed. If possible, get a seat in the front so you feel the prof is watching you, and the shame (that you feel it is what matters, whether the prof actually cares is irrelevant) will help keep you from jumping onto your phone or smth.