Your spellcasters’ Range will be primarily affected their movement range. Most offensive spells can reach enemies 1-2 spaces away but there Intermediate or advanced spells that has longer range. The basic heal spell can target adjacent allies but its intermediate version, Physic, can have a range depending on the user’s MAG Stat (MAG/2 - 1) Silence is also another long-range spell that can reach 3-10 spaces.
If your unit has the means to target a unit, the game conveniently and automatically selects that weapon or spell. For spellcasters, weapons are usually not a big deal since they heavily rely on their spells to be effective on the battlefield. Obstacles like walls or elevation are ignored as long as the spellcaster and the target are in Range.