A jet against a Shahed or Geran, especially at night, and in weather, would be a challenge using the cannon. Those are moving about the stall speed of the jet and about 100 knots slower than their approach speed for landing.
Getting close enough in a similar speed airplane like a Yak or Sukhoi or whatever they might be using to fire on the drone with a gun could be dangerous if you were too close when it explodes.
Flying through the debris is very hazardous to plane, pilot and crew!
A-10s, attack helicopters and close air support/attack turboprops might be good against drones. Purpose built drones seem to be working well also for slower drones.
I was referring to the plane used in this thread, one with a propeller, and guy with shotgun sitting in an open seating area to be able to shot his gun at the drone.