Craft 3: Preventing Element from Saving in Plugin
The event fired by element service is not cancellable, as that is a bit too broad to be controlled like that. Instead, you should be listening to the EVENT_BEFORE_SAVE on the User element as that supports the isValid property.

use craft\events\ModelEvent;
use craft\elements\User;
use yii\base\Event;

Event::on(User::class, User::EVENT_BEFORE_SAVE, function(ModelEvent $event) {
    $event-&gt;sender-&gt;addErrors([
        'password' =&gt; 'Passwords do not match.'
    ]);
    $event-&gt;isValid = false;
});