Cavalry gets dragged into other units when you clip them, so try to stay completely clear of the enemy you don't want to fight. This is for the open battlefied.
Inside cities, yeah, they completely go crazy.
As for the archers, yes, they don't fire properly when ordered in groups (credit hoom for this), so order them one by one. Also turn off fire-at-will when ordering them.
Edit: Change the width of your cavalry (and other units for that matter) when moving them inside cities (at least that's what I do), so when they reform they won't clip the buildings and such.
One other solution for the cavalry on the open field is using the right-click-dragging (then ), instead of plain clicking on the ground.
Bookmarks