Type *#33# and press Call.

Most modern Android phones (Samsung, Google Pixel, Motorola, etc.) have this setting embedded in the Phone app. call barring settings

Call Barring is a powerful tool provided by your network carrier to help you manage costs and security. While modern smartphones have made it easier to block individual contacts, the old-school Call Barring settings remain the best way to prevent unauthorized international calls or avoid roaming charges. Type *#33# and press Call