block to display nodes using entityQuery with pager
The first step is to include a pager in the query $query-&gt;pager(10), which you have already done. Then you need a render element pager:

  $build['result'] =&gt; $out;
  $build['pager'] = [
    '#type' =&gt; 'pager',
  ];
  return $build;


If you have multiple pagers on the site, which is probably the case for a block placed on different pages, you have to connect query and pager with a pager id:

  $element = '123';

  $query-&gt;pager(10, $element);

  $build['pager'] = [
    '#type' =&gt; 'pager',
    '#element' =&gt; $element,
  ];