block to display nodes using entityQuery with pager I am trying to figure out how to create a block that displays recent content using a pager that can fetch the next set of nodes 
here is what I have so far 
/modules/example_module/example_module.info.yml

name: Example Module block with pager
description: 'Example Module block with pager'
core: 8.x
type: module
dependencies:
- node
- block
type: module


/modules/example_module/src/Plugin/Block/ExampleModuleBlock.php

&lt;?php
namespace Drupal\example_module\Plugin\Block;
use Drupal\Core\Block\BlockBase;
/**
 * Display all instances for 'ExampleModuleBlock' block plugin.
 *
 * @Block(
 *   id = "example_module_block",
 *   admin_label = @Translation("Example Module"),
 *   category = @Translation("Example Module"),
 * )
 */
class ExampleModuleBlock extends BlockBase {
  public function build() {
    $output = example_module_get_content();
    $out = [
      '#markup' =&gt; $output,
      ],
    ];
    return $out;
  }
}


and /modules/example_module/example_module.module

&lt;?php

function example_module_get_content(){
  $out = "";
  $nids = example_module_query();
  foreach($nids as $nid){
    $node = \Drupal\node\Entity\Node::load($nid);    
    $out .= "&lt;div&gt;" . $node-&gt;getTitle() . "&lt;/div&gt;"; 
  }
  return $out;
}

function example_module_query() {
  $query = \Drupal::entityQuery('node')
    -&gt;condition('status', 1)
    -&gt;sort('created', 'DESC') 
    -&gt;pager(10);
  $nids = $query-&gt;execute();
  return $nids;
}


which creates a block that can be placed on a theme and displays the latest/recent 10 nodes on the drupal site.

Well I can probably devise a way to query the database and figure out a way to create a custom pager and probably use $current_path = \Drupal::service('path.current')-&gt;getPath(); to get the pager PAGE but I was wondering if there is an obvious way that could greatly help and I don't have to reinvent the wheel

what is the deal with pagers are they of any help here ?
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,
  ];