The Magento 2 cash on delivery restricts module enables limiting specific locations on the basis of zip codes. Also, all the zip codes will be imported through CSV files.
For More Details: https://magecomp.com/magento-2-restrict-cash-on-delivery.html