How to create controller which provides filter and results alongside

 In Drupal 8 a filter is nothing but a form, it can be displayed above results provided by controller in following way.

//Getting form markup in $form variable.Replace example_drupalabc with your custom module.
$form = \Drupal::formBuilder()->getForm('Drupal\example_drupalabc\Form\FilterForm');
//Adding $form in $build array.
$build['filter'] = $form;
//Now your controller can add other data in various ways.Some of them are:
$build['links'] = [ 'data' => [ '#type' => 'operations', '#links' => $links, ],
];
$build['requests_table'] = [ '#theme' => 'table', '#rows' => $rows, '#header' => $header,
];
//You can also add a pager.
$build['pager'] = [ '#type' => 'pager', '#weight' => 100,
];
//Don't forget to return $build.
return $build;