Sort with entityTypeManager
The change record says if you have entityTypeManager injected, use

$query = $this-&gt;entityTypeManager-&gt;getStorage('node')-&gt;getQuery();


For non-OOP code, $query = \Drupal::entityQuery(); is not deprecated and can still be used.

The linked example for sorting an entity query by using $query:

$query-&gt;condition('type', 'blog_post')
  -&gt;sort('field', 'DESC');
$nids = $query-&gt;execute();