The link target2019 provided is good but left out a click or two depending on your screen and OS version.
System Preferences>Network Panel>Click on your Internet Connection (Airport, Ethernet, etc.). Select "Advanced". Click on the DNS tab at the top.
At the bottom under the box click on +IPV4 or IPV6. In the blank box that appears add the DNS number, select O.K, then Apply.
Suggestion: Write down your current DNS numbers before you make any changes. When I added the first new DNS, it deleted or looked like it got rid of the old ones. Not knowing what they pointed to....I added them back along with the new ones. You may have to go in and out to make sure you have all the ones you want.
here is the url I referenced in my post above: