When a player initially joins a world, there is no spawn immunity. In previous versions, such as 1.21.3, players received an initial immunity when joining a world for about 3 seconds. In 1.21.4, that spawn immunity has been removed, so when they join a world now, the instantly take damage.
Related issues
duplicates
Comments

Thank you for your report!
We're tracking this issue in MC-278547, so this ticket is being resolved and linked as a duplicate.
That ticket has already been resolved as working as intended, which means this is not considered a bug and won't be fixed. Please do not leave a comment on the linked ticket.
If you haven't already, you might like to make use of the search feature to see if the issue has already been mentioned.
Quick Links:
📓 Bug Tracker Guidelines – 💬 Community Support – 📧 Mojang Support (Technical Issues) – 📧 Microsoft Support (Account Issues)
📓 Project Summary – ✍️ Feedback and Suggestions – 📖 Game Wiki
This works as intended, please see MC-278547 and MC-278867