When a site breaks after changing the address, it is often because the siteurl option does not match the absolute path of your Wordpress installation.
In order to revert the address changes made to a Wordpress site, we will need to edit the database. I personally find this method very easy, and you can either do it from within PHP or from a terminal.
Another option, if you are not comfortable using SQL, is to try to change it via PHPMyAdmin. You should select the wp_options table, and then change the row where option_name equals siteurl in the database. Change the option_value to the absolute base path of your site installation.
You can also change it simply using this query, after logging in to MySQL:
UPDATE wp_options set option_value='https://example.com/' where option_name='siteurl';
From within PHP, you would need to execute the above query using mysqli or similar. Simply creating a temporary file to run the query should do the trick.
Note. If Wordpress is installed in a subdirectory instead of the site root, then you will need to make sure to update the siteurl with the correct absolute path for the subdirectory. I.e: https://example.com/some-subdirectory/
If you installed on a subdomain, then you will need to make your query reflect that as well. I.e.: https://mysubdomain.example.com/
I am not even sure why Wordpress makes it possible to change the site address from within the control panel, too many fumbling users break their sites, and then they have to edit the database to fix it. There is no need to change the domain name from the control panel, since it will obviously just break the site.