For some reason, if you die and come back to The End, the dragon flying about will no longer be the dragon attached to the health bar, and killing it won't activate the portal. In my testing, the original dragon is either no where to be seen or very high up.
Steps to reproduce:
1. Go to The End and deal some damage to the dragon. Run /damage @e[type=ender_dragon,limit=1,sort=nearest] 100 minecraft:bad_respawn_point
Notice how the health bar goes down appropriately.
2. Leave and return to the end.
Notice the dragon's health bar is no longer correlated to the damage the dragon you see receives. The second dragon is invisible and can't be affected by commands for a while but will reappear. When it reappeared in my posted video i promptly got jumpscared.😛
Video demonstrating the issue:
I'm closing this as a duplicate of MC-262557 because it's likely the same core issue (leaving the end during active dragon fight respawns the dragon).
If the issue is not fixed when MC-262557 is resolved, please file a new bug report.