I would bet on swarm of drones to scan the whole location and provide data to central/distributed inteligence. Than human (assisted with AI) would sort out targets/non-targets and the swarm would keep them in visibility at all time to not lose track who is who. Until you know, who is bad guy and who is victim, there is no much sense in shooting.
Then the sniper cames to play - it may be human with gun (but there is big problem to put him in a place in urban envirnment fast enought) or it can be sniper drone. The balistic of the bullet can be computed somewhere else, then just the sniper shoots at designed target and the bullet have to hit it. Having swarm of sensors around and sniper gun equipped with a lot of electronics too, the bullet can be much simpler and just follow precomputed way and make just small corrections suggested by the swarm and sniper.
If there is big and fast change in scenery, the bullet can just explode mid-air and be fragmented to small pieces which lose velocity realy fast and make just little (and curabel) harm, even if they hit.
Anyway if you need "sure-hit-at-all-cost" then bullet is too fast and too hard to presice manuevre and target recognition, small rocket, or even drone, would be much better substitution (more space for electronics ans mainly sensors, much better manuevruability and it still can be really fast (say crosbow-arrow fast or even more) and able to avoit non-targets at the same time).
The price would be larger, than for plain bullet, but probably lesser than for electronical self-guiding face recognizing, fast desion making bullet - as you can use larger elecronics and sensors (so easier to make, more powerfull and sensors more acurate) and offset nearly all the inteligence to the swarm (and computing after that), so on hit you sacrifice just basic sensosr, sipmple actuators and sender/receirver unit, not full supercomputer squashed to fraction of place (and all above also extremly miniaturized).
This bullet-drone can be missile of size like bottle or so, easy manufacturable, cheap to create and able to safely selfdestruct, as the velocity of its parts would be much smaler. And the swarm-net can see the whole area from all angles and main computer can be as big and powerfull as you want, if you want, you can fit it to jumbo plane or warship or truck (or bettr tank/armored vehicle) or what you want and have at hands.
(Also see the shift from old megacomputers to internet, cloud and IOT - I see similar way from old main battle tanks and warships to aircraft carriers (which does not fire bullets, just send planes) to future urban warfare, where you need "make war" between civilean on streats and shopping centres without much collateral.)