There are cases in which Google Search Console, Magento Security Tool or any other service ask to verify you to be the owner of the site and confirm it by adding to the  Page <head> tag a code. In order to easily add it in the Magento 2 please go to Admin Panel > Content > Configuration.

Magento 2 Custom Code, Head Tag

Then, choose the store view you want the head tag to be changed on or select Global in order to change it on every store views.

Magento 2 Custom Code, Design Configuration

Afterwards, find the HTML Head section and add your code in the Scripts and Style Sheets field.

Magento 2 Custom Code,Scripts and Style Sheets

Once the changes have been performed don't forget to press the Save Configuration button and flush Magento cache.

Magento 2 Custom Code, Save Configuration