Answers
How does cash on delivery work?
The courier settles with the retailer up front, then collects the cash from the customer at the door. The retailer is never left exposed to a courier who does not return with the money.
In more detail
The intuitive arrangement (courier collects the cash and brings it back) leaves you carrying the risk on every delivery in progress at once. The more couriers you use, the more outstanding cash you are exposed to, and you cannot tell a delayed courier from an absent one.
Settling first inverts that. You have already been paid before the food leaves. The cash at the door is the courier's, and nothing is outstanding at any point.