A decent arquebus and a late-end steel-stave crossbow ("arbalest") are about equals in killing power and armor penetration, and the crossbow actually has a longer accurate range. However, an arquebus is slimmer and takes up less room, is mechanically simpler and more reliable (it's undamentally nothing more than a metal tube plugged at one end), makes for a better club in a pinch, punches through cover better and is, quite frankly, scarier. Both people and animals are simply scared of the loud noise, flame and smoke it produces - I've read that in the first battle in which the Russians used firearms against the Golden Horde the nomads were so shocked by the first discharge (which didn't even cause any meaningful casualties) they simply rode off the field...

This is probably the key to the comparative efficiency of firearms - not so much the killing power as the psychological effect, especially of volley firing.

On the whole an arquebus can do most of the things a crossbow can, and enough of them better that it eventually replaced it.

Now, archers are nice and ones with composite bows even nicer; the problem tend to be the availability, as barring more or less full-time profesional troops who train diligently the about only way to get them is to have a populace who uses them matter-of-factly in their everyday lives. Steppe nomads and assorted hunters are a good source. The English yeoman system was an attemp at "artificially" producing a pool of skilled archers, and while it worked fairly well it was anything but an ideal solution and there were constant issues in making the peasants actually fulfill their training quota in tha practice butts - most of them frankly had better things to do. Medieval Scandinavia (and presumably East Europe) had it better, having vast stretches of sparsely populated woodlands the peasants could hunt in and hence a decent pool of skilled archers who could be enrolled into the military.

The problem, even with composite bows, seems to have been that even the Janissary foot archers do not seem to have had enough drill to reach the sheer volume of fire necessary to stop an armored cavalry charge. You had to pour a pretty serious amount of arrows into the assault line to cause enough casualties and chaos for the charge to falter, and it appears even elite archers rarely achieved this.

The Mamluks apparently managed to drill their horse-archers (who shot standing still, as "regular" horse-archers of settled nations are wont to) to the degree where these could stop a Crusader charge on sheer firepower alone, though.

Infantry makes much smaller targets than horsemen and get more cover out of their shields, but on the other hand are slower moving; it seems to have been a bit case-by-case how well archery worked against such troops, especially if they were armored.