Ahh OP 
Been through this all with my Gramps! He lived with us for ten years and it got to a really dangerous point where he was creeping out in the middle of the night and being brought back by the police after some kind soul on the street noticed him (he had our address in his wallet ‘just in case’ and thank goodness he did)
After a lot of tears and soul-searching, we agreed as a family that 24hr residential care was the safest option for him, but he came home with us for dinner every night
and then went back there to sleep.
It’s the most heartbreaking decision to have to make, and you will feel guilty as hell but please, please remind yourself that none of that guilt is as bad as it would be if your DM was hit by a car on a nighttime wander.
It’s not prison, you can still visit, bring her home for tea, take her out somewhere nice. It really does sound like it’s the best, safest solution for everyone involved.
You’ve achieved a wonderful thing, keeping her alive and at home to the age of 98 (!) and now it’s time for the next step.
As for funding, if she has no savings and only a state pension, she will not be self-funding. Her SW will go through all this with you at your appointment. If, however, you feel your DM will not be safe until the appointment then please do say so to SS as there may be an option for emergency respite care.
Best of luck, come back to us whenever you need to. PM if you need any practical/emotional advice. More
for you.