Aren’t they using guns to fight cheap drones, at least for cities in Ukraine ? Eg Gepard.

Gepard is a specialized anti-air vehicle with a radar and pretty expensive shells. Very effective and cheaper than Patriot/NASAMS/IRIS-T missiles, but not really cheap. It’s mainly used on the outskirts of big cities, AFAIK.

When intercepting drones and rockets in a middle of nowhere, what’s often used is a regular machine gun that’s mounted on a pickup truck.

What goes up must come down, including the unexploded ordnance these systems produce. Not ideal for use in populated environments.

The better AA autocanon shells actually have a timed airburst fuze (set at firing time!) so only small fragments should be raining down (for non-dud shells).

Ukraine is using everything that they can get their hands on - regardless of how effective it actually is.

Gepards have pretty short range in comparison to any missile system.