Welcome to Q&A platform.
My understanding is your domain name is same as the website name. If there is any misunderstanding, please correct me.
The workaround is create an A record in the DNS zone named "www.domain name" without the quotes and point it to the website.
Or you could configure Split-Brain DNS, for more details you could refer to the following articles:
Use DNS Policy for Split-Brain DNS in Active Directory
Split Zone or no Split Zone – Can’t Access Internal Website with External Name
Please Note: Since the website is not hosted by Microsoft, the link may change without notice. Microsoft does not guarantee the accuracy of this information.
And here is a similar thread discussed before, you could have a look:
DNS (internal domain has same name as external website)
If the Answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.