If you have a 2018+ Mac with a T2 security chip or an Apple Silicon Mac, then here are the Apple articles for "Restoring" the firmware & macOS using DFU Mode:
Revive or restore an Intel-based Mac using Apple Configurator - Apple Support
Revive or restore a Mac with Apple silicon using Apple Configurator - Apple Support
You will need access to another Mac running macOS 10.15+ in order to perform the "Restore".
In order to boot to an external USB drive or installer, then you will first need to boot into Recovery Mode (Command + R) or Internet Recovery Mode (Command + Option + R) where you will need to use the Apple Startup Security Utility in order to modify the Mac's security settings to allow for booting from USB:
About Startup Security Utility on a Mac with the Apple T2 Security Chip - Apple Support
Here is an Apple article with instructions for creating a bootable macOS USB installer which requires access to another Qualifying Mac which is compatible with the OS you are trying to create:
Create a bootable installer for macOS - Apple Support
The firmware "Restore" option may be required for T2 and Apple Silicon Macs when other options fail.