Changing IP address into a domain name on a self-hosted server

Hello! I am from bulgaria so sorry if I make grammatical errors. I am trying to host my own website on Ubuntu 20.04.01 LTS. The website is working fine, when I type the domain name it takes me to the desired website, however, it changes the domain to the IP address of the server. If I change the settings on Wordpress the website stops working so that is not an option. I tried making a BIND9 DNS server but still failed. Someone I know told me to install apache with the domain but I don’t know how to do it. If anyone has any ideas please inform me.