I’ve had so much trouble with this. Recently, I got a really good tip from the ADHD Rewired podcast for this type of transition: just pause and take 5 deep breaths. More often than not, I find that it breaks through hyperfocus and makes it much easier to leave behind what I was doing.
Also, when I find I ignore a reminder or alarm, I set more of them. In different apps, at 5 minute intervals, with increasing intensity, so the last one is the most disruptive. Maybe even get one of those alarm apps that makes you do something to turn it off, like take a picture or solve a math problem. I have no hesitations about overkill. Over time, whatever I’m trying to do becomes more automatic, and I can “downgrade” my alarms.
Also, I second what @khagen suggested about having a bed routine-- and I’d be sure to build in plenty of time between stopping work and your target bed time to do it.
Coincidentally, right now I have to try out my own advice and transition to walking my dog . She’s knows it’s time, and she’s starting to make noises.