When someone has dementia and doesn't know who you are, they still appreciate someone visiting and spending time with them.
My kids complained when my grandfather had caregivers send Christmas card from November to February. I explained that at least he remembered it was around the holidays and remembered us, so be grateful he's trying.
It was hard when he forgot most of the past 30 years, and he simply thought I was his child bringing his grandchildren. In that time frame, he was delighted the "grandkids" came to visit, someone came to visit. The nurse said he'd talk for a week about how his family came to visit him, even if mixed up on WHO it was. We left art the children made as a reminder for him to show off.
When he didn't remember who it was per se but vaguely understood it was family, I had the kids talk about their lives and reminded him that they were family. The staff said it still mattered, because later that day, he'd ask if the children were still there. His family had come, he was told, and that made him happy.
Towards the end, he was relieved that someone was there, that he wasn't alone except a nurse or staffer. He didn't know who I was, wasn't sure how to respond to the kids, but I tried to make it clear family was here to visit. Some of the others in the care home talked to the kids about their lives, and my grandfather listened to the conversations, sometimes commenting. I asked the children to ask him about HIS life, and he felt more connected.
Even when they don't remember you exactly, they may viscerally feel better that someone who cares is there. When they aren't sure on the relationships, just play along.
Other people in the care home would only see family perhaps mother's day and Christmas, unless bills were due.
After they are gone, you remember the slowly fading away and how you did the best you could in the time they were there.