Did anyone ever do this? In a pinch, probably. Was this typical tactics for a unit of archers in warfare? No.
Individual archers in a unit weren't trained to aim at specific other individuals in an opposite unit. Instead units were trained to fire gigantic volleys of arrows (or alternately a continuous fire-at-will rain) into the mass of opposing units. Doing so at maximum range means, by definition, the arrows would be coming down at something like a 45 degree angle, not still rising as would be required to reliably only hit higher objects. To be hitting things on the upward trajectory, you've have to be at closer than half range. For obvious reasons, that's not where a unit of archers wants to be.
For this reason, having them fire into the middle of an engagement would be inadvisable, as they'd be just as likely to hit friendlies as enemies. Arguably even more likely, if shields were involved, as their side's shields would likely be pointed away from the incoming fire.
Reported successful anti-horse tactics for units of archers involve using pits, stakes, or entire units of pikemen in front. For example, at the definitive archer-won battle of Agincourt, the English bowmen set up with woods at their back and flank, and used wooden stakes pounded into the soft earth to protect their front from cavalry.
How about if the horse did get into melee with the archers? Again, this is a suboptimal outcome for the archers that they don't want. The unfortunate cavalry at Agincourt didn't manage it (which is part of why their side didn't win), but their heavy infantry did.
The surviving French men-at-arms reached the front of the English line
and pushed it back, with the longbowmen on the flanks continuing to
shoot at point-blank range. When the archers ran out of arrows, they
dropped their bows and using hatchets, swords and the mallets they had
used to drive their stakes in, attacked the now disordered, fatigued
and wounded French men-at-arms massed in front of them
So yeah, it looks like they'd still use their bows as best as they can once the fight got to close quarters. But clearly this isn't going to be nearly as effective a way for them to fight as standing back and perforating the foe from a range they can't respond. The saving grace at Agincourt was that their opponent by the time they got there was more tired, and fighting in a mudhole that made their heavier armor actually a liability.