Automatically block orders made with same phone number for COD orders

I need a custom code that would automatically block all orders made with the same phone number for COD orders, as well as block all orders that are made with a phone number present on a blacklist of phone numbers