This is most likely caused by Epic Fight. With Epic Fight, the Ender Dragon sometimes lands on the ground and attacks with its claws instead of perching on the portal. I had the same issue, so I made a small mod that removes the dragon’s invulnerability so the fight doesn’t get stuck. https://www.curseforge.com/minecraft/mc-mods/epic-fight-true-ending-compatibility