The easiest way is to use search and replace for wordpress databases
Then you should do a 301 redirect the old domain to the new domain to keep visitors and indexed in Google.
RewriteEngine On
RewriteCond %{HTTP_HOST} !^old-domain\.com [NC]
RewriteRule (.*) http://new-domain.com/$1 [R=301,L]
I hope I’ve helped you with my answer.