code: private function isHostInDomainList($host)
      {
          $urlTypes = [
              UrlInterface::URL_TYPE_LINK,
              UrlInterface::URL_TYPE_DIRECT_LINK,
              UrlInterface::URL_TYPE_WEB,
              UrlInterface::URL_TYPE_MEDIA,
              UrlInterface::URL_TYPE_STATIC
          ];
          $secureScheme = [true, false];
  
          foreach ($this->storeManager->getStores() as $store) {
              /** @var \Magento\Store\Model\Store $store */
              foreach ($urlTypes as $urlType) {
                  foreach ($secureScheme as $scheme) {
                      $shopHost = \Zend_Uri::factory($store->getBaseUrl($urlType, $scheme))->getHost();
                      if ($host === $shopHost) {
                          return true;
                      }
                  }
              }
          }
          return false;
      }
docs: Checks if host is one of Magento's configured domains.
  
  @param $host
  @return bool
  @throws \Zend_Uri_Exception