Good advice in here:
https://www.janetlansbury.com/2017/12/potty-struggles-4-year-old/
My DD struggles with this as well, and the thing in here that really resonated is where she talks about how kids get down on themselves when they've been praised a lot for fond potty training well and then struggle, and it feels like a more intense failure because they've been told how proud their parents are every time they use the potty.
Something that works with my DD is that we tell her early in the day "Hey, we aren't going to ask you if you need to use the potty today, okay? We know that you know your body and that you know when to go. We trust you to do what you need." And then we really just leave her alone. It's the best way we've found to give her a little reset and get her back on track. Because when she's avoiding the potty, or saving poop for her nighttime pull up, or whatever, we have a tendency to start asking her more often "do you need to use the potty" or suggesting she sit on the potty more often. And it can create too much pressure on her and make the problem worse.
So maybe try just telling her straight up that you trust her and that you know she knows what to do, and then just stop talking about it. What we do is prompt the potty first thing in the morning and then take all the pressure off the rest of the day. And it works! This is also how we got her to finally start pooping in the toilet instead of just in her little training potty in her room. It's just really helped her devleop her confidence.