Just like weapons, spells with “Range” can target creatures from a distance, but are cast with disadvantage if any enemy is adjacent to you. Add 1 die of disadvantage to gain +2 Range (max +6). Spells with “Reach” can’t do this, but they are cast as normal even when in melee.
Range and Reach
Core Rules v2 p. 44
FAQs
1How does Barrier of Wind interact with Defend?
OfficialCore Rules v2 p. 55
When an ally is attacked at Range, if you upcast Barrier of Wind, you can Defend to protect them provided they are within Reach.
Related Rules
4Cones & LinesAdventuring / Movement, Range & Space
Multi-Target/Area of Effect (AoE)Magic / Targets, Areas & Saves
Range & ReachAdventuring / Movement, Range & Space
Secret SpellsMagic / Casting Spells