These instructions are for the current version of iOS/iPadOS.
For the iPad, pull down the Control Panel, tap on focus, then tap on Do Not Disturbe. You can choose options other than just on/off by tapping on the three dot icon.
On the iPhone you can do the same.
To allow certain people to contact you when Do Not Disturbe is on, add them to People under the Allow Notifications settings in Setting > Focus > Do Not Disturbe. Once you've added at least one person there will be further controls. Read the descriptions next to them and choose what you prefer.
If you turn on Share Across Devices, the turning on Don Not Disturbe on one device will turn it on for both. In my brief experiments, settings in inside Do Not Disturbe also duplicate across devices. You should only need to add allowed people once. (Might be different if the Share Across Devices option is off).
There are other options for turning Do Not Disturbe on/off, including Siri and Shortcuts. On iPhones with the current version of iOS you can add a custom lock screen that will automatically switch to Do Not Disturbe when you switch to that lock screen.
With Focus in iOS 15 and iPadOS 15 or later, you can use Do Not Disturb to silence calls, alerts, and notifications that you get while your device is locked. You can also schedule Do Not Disturb and allow calls from certain people.
With iOS 15 and iPadOS 15 or later, Focus lets you stay in the moment when you need to concentrate or step away from your device. You can customize Focus settings and choose when you want to receive alerts and notifications, while letting other people and apps know when you’re busy.