When does a late invoice become a bad debt?
Late is not bad. An invoice is a bad debt when you have concluded, reasonably, that the money is not coming: the customer has entered liquidation or bankruptcy, cannot be traced, or has refused to pay and the amount does not justify court action.
Writing it off does not mean giving up on it. It means the accounts stop treating it as an asset. If the customer later pays, the write-off is reversed and everyone is pleasantly surprised.
The write-off is a cost in the profit and loss, usually on its own line so it is visible. It reduces taxable profit, because the sale was taxed when it was invoiced and it turned out not to be a sale at all.