I think what's happening here is that you've already reached the point where gentle comments aren't working, so you need to change your approach. But that doesn't mean you should get aggressive either. What you need is to have a conversation outside the moment when they're scrolling, when you can talk without them feeling attacked. Like, when you're having coffee or doing something chill, you tell them something like "look, I need to be honest with you because I care about you and this affects me: when we hang out and you're on your phone the whole time I feel like I don't matter to you". Full stop. No lectures, no listing all the times they've done it.
The important thing is that they understand why it bothers you, that it's not because you're a demanding or old-fashioned person, but because you value time with them and real time. Some people just don't realize what they're doing until someone who matters to them tells them straight up. After that, if they keep doing it, well, you'll have done your part. Sometimes people choose not to change even though they know it bothers you, and that's on them.
But yeah, when you see them and they start with the phone, you can just get up or naturally change the subject. You don't need to sit there watching them scroll if you don't feel like it.