Found this really good simple guide from Sparked Host for people that I would like to share.
Using your domain to connect to your server looks more professional and encourages people to join.
Learn how to connect a domain with a Minecraft Server using Cloudflare.
How to connect a domain with a Minecraft Server with a dedicated IP (Cloudflare)
Login into the Cloudflare dashboard and select your domain
On the left-hand side, Click “DNS” and then click “Add Record”. Firstly, we need to create an “A” record. You will need to fill out the following:
Name - This is the option to either make it a subdomain or not. In this example, we will use “play”. This will make it so we have to connect using play.domain.com.
IPv4 Address - This is the IP of the server NOT including the port numbers.
Proxy Status - Uncheck this. It should be a gray cloud with the text “DNS Only”.
TTL - Leave this as auto.
Once complete, Click “Save”.
Your domain is now usable. Players are now able to connect to your Minecraft server using the domain.
How to connect a domain with a Minecraft Server without a dedicated IP (Cloudflare)
Please note that this method will not work with Minecraft Bedrock. You will need to include the port when connecting to the server, or get a dedicated IP for your Minecraft Bedrock server.
Login into the Cloudflare dashboard and select your domain
On the left-hand side, Click “DNS” and then click “Add Record”. Firstly, we need to create an “A” record. You will need to fill out the following:
Name - This is the option to either make it a subdomain or not. In this example, we will use “play”. This will make it so we have to connect using play.domain.com.
IPv4 Address - This is the IP of the server NOT including the port numbers.
Proxy Status - Uncheck this. It should be a gray cloud with the text “DNS Only”.
TTL - Leave this as auto.
Now we have to create another record. This time an “SRV” record. Select “SRV” under the “Type” dropdown. You will need to fill out the following:
Name - This is the first part of the domain that you have chosen before. In this example, we are using “mc”.
Service - Set the service name to _minecraft. This is super important!
Protocol - Leave this as TCP.
TTL - Leave This as Auto.
Priority - Set this to 0.
Weight - Set this to 0.
Port - This is the port of the server. In this example, we will be using port 28017
Target - This is the whole domain name that you have chosen. In this example, the target is going to be play.sparked.xyz
The end result should look similar to the following screenshot:
Your domain is now usable. Players are now able to connect to your Minecraft server using the domain.