^^^Above asks good questions.
It's certainly possible to design a circuit to limit current to 3A when the input is 5V, or 2A when Vin is 9V, but it will either require a bunch of components (op-amp based control loop) or drop a good deal of voltage (~1V or so) even when current is just under the maximum permitted (e.g. - the classic two-BJT current limiter circuit).
A foldback current limiter would likely be a better choice here, but the OP didn't specifically say why current needs to be limited, or what the downstream load actually is - presumably a battery charger, and not a battery itself, because there aren't any batteries that will be happy having either 5V or 9V applied to them. Given that, it makes more sense to use an efuse rather than try to turn a voltage source into a current source, especially at 2-3A, as that could result in 15-20W of dissipation per channel in the event of a hard and persistent short.