When upgrading to drupal 9 you can encounter the following:

 Call to undefined method Drupal::EntityManager()

Change your code from:

$entity = \Drupal::EntityManager()->loadEntityByUuid($entity_type, $uuid);

to

$entity = \Drupal::service('entity.repository')->loadEntityByUuid($entity_type, $uuid);