How to programmatically build a page and a form in the same page
You must use the formBuilder, like this:

$render = [];
$render['elememt1'] = [
  '#type' =&gt; 'markup',
  '#markup' =&gt; t('Test'),
];
$render['element2'] = \Drupal::formBuilder()-&gt;getForm('Drupal\MY_MODULE\Form\MyFormClass');// The destination of your form.

return $render;