The only benefit to a warning shot is to the intruder, whom you’ve just warned that you have a gun.
I believe you fire the warning shot after the perp is dead for CYA purposes.