If you stand still, mobs have a very hard time hitting you. They try to turn their head at you but deal no damage.
Related issues
duplicates
Attachments
Comments

Can confirm.

Doesn't seem to happen to me
Can confirm. Especially with Husks.
Its actually happen since 1.15
Logdotzip mentioned that in a video. Slicedlime also did, and I thought this was fixed for a long time or somebody else reported it.
Pretty sure it got fixed and is making a comeback rather than long time unfixed. Last time this bug was around it was something to do with players perfectly centered in their blockspace. Creatures attacking you could push you backward into the perfect position to cause this bug, you just had to resist the urge to push forward or backward while fighting.
EDIT: just tested and it doesn't seem to be related to being centered, the zombie just stops being able to do damage after a hit. After a bit he walks away and comes back. This lets him do 1 more hit. As I said earlier, resist the urge to push forward or back, just let the monster push you into the "sweet spot".