Problem with \craft\elements\User::EVENT_AFTER_SAVE
I don't know what your specific error is, but whenever I use

Event::on(
\craft\elements\User::class,
\craft\elements\User::EVENT_AFTER_SAVE,


I need to provide the next parameter with a \yii\base\Event callback, not a \craft\events\ModelEvent one.

Maybe that's your case as well ?
 You can also use \yii\base\ModelEvent, but not the craft one, as the craft ModelEvent does not extend \yii\base\Event