Yeah, multiple stacks of multiple troops in one square could be tricky.
I think, therefore, that when casting a spell that requires a target you could either
1) Click the little round coin with the unit icon on
2) Click on the square and a selection screen comes up that shows all units in that square which are a valid target for that spell.
3) Click on the little shield icon in front of the unit icons
Much like what happens when you click on the little shield icon next to the units in a city. It pops up the "Stationed Units" selection screen so you can select which units to "eject" from the city.
So now it could pop up a "Choose Target" popup that is identical to the "Stationed Units" popup.