The answer depends on your intentions, but there are two ways to defend against an Enderman.
1 - Avoiding: Do not look at their face. Even if an Enderman is standing directly in front of you, they will not become aggressive if you keep your gaze below their head. You can stare at their legs or torso without provoking them. A docile Enderman will never hurt you. If you don't think you can avoid looking at an Enderman, try lowering your cursor so even if one surprises you behind a corner you will not be staring at their face.
2 - Attacking: If you have to, or want to, kill an Enderman you can use your height advantage, or lack thereof in this case, to protect yourself. Endermen are three blocks tall according to the wiki. The player is just below 2 at 1.8 blocks tall. You can build a shelter or small floating platform three blocks high and stand underneath it in such a way that you can attack an enderman and they cannot hit back. Alternatively, the brute force method of killing an Enderman with ease, even on hard difficulty, would be to equip very strong Armour and use potion effects to your advantage.
Endermen can cause the following amount of damage without any protection:
♥♥♥♥♥.25 damage per swing on Hard
♥♥♥♥ and 1/2 on normal
♥♥.25 on easy
Making Endermen one of the most dangerous mobs to fight, and for this reason I would recommend Diamond armor or above if attacking with brute strength.
The absolute best weapon to fight an Enderman is a Netherite sword with Sharpness V, which on Bedrock edition can deal 15.25 damage without critical hits, meaning you can slay an Enderman in three hits. Unfortunately, I don't know the exact calculations that using a sharpness V Netherite sword with a Strength II potion effect would deal damage wise, but there is no harm in trying!