Don't get too close though or it will alleviate the problem that your units are actually killing anything, too
The way to go usually is to either switch them off if you think you take too much damage through friendly fire, or to fire at units where the probability of hitting an enemy is much higher than that of hitting a friend.
Or get them around and shoot the enemy in the flanks (note that you risk a few archers when you do that, but it's often worth it).