If you place a piece of bedrock and then an end crystal on the bedrock next to a villager, it will one shot them, but if you do the same next to a bed a villager is currently sleeping on they will take more than one hit to kill.
3 day old creative Infinite world (not amplified, single biome or superflat), Allow commands true, Cheats on.
When the villager is standing, the explosion directly hits the villager, since there is nothing blocking the explosion from reaching the villager.
When the villager is sleeping, the villager hitbox shrinks (See MC-148559), and the explosion is slightly blocked by the bedrock, reducing the damage. Removing the bedrock before exploding the end crystal will kill the villager.