How do I send an email when users update their email address? If users update their email address, an email should be sent to the old and new email addresses to confirm the transaction.

How can I achieve this in Drupal 8?
You could add a HOOK_user_presave method in your custom module.

Example:

function mymodule_user_presave(\Drupal\user\UserInterface $user) {
    if ( !($user-&gt;isNew()) ) {
        //check if the value in the db is different to the value in $user
        if ($user-&gt;original-&gt;getEmail() == $user-&gt;getEmail()) {
            // send email
        }
    }
}