If you dig a 1x1 hole and jump into it, you would be able to attack mob from under, and mob cannot reach you.

I've tested, for most of the mob such as dark skeleton boss, aaron, viking etc with melee attack and range less than 3-4 block can use this bug to kill them

other mob such as dragon have quite a long range and you will still be attack