How do I find the search block form ID?
The first thing to do is extend SearchBlockForm so you can give it a custom ID. Put code in mymodule/src/Form/MymoduleSearchBlockForm.php

namespace Drupal\mymodule\Form;

use Drupal\search\Form\SearchBlockForm;

class MymoduleSearchBlockForm extends SearchBlockForm
{
  protected $formIdentifier;

  public function setFormIdentifier($formIdentifier)
  {
      $this-&gt;formIdentifier = $formIdentifier;
  }

  public function getFormId()
  {
    $form_id = 'search_block_form';
    if($this-&gt;formIdentifier)
    {
        $form_id .= '-' . $this-&gt;formIdentifier;
    }
    return $form_id;
  }
}


Then you can call your form like this:

$form = \Drupal::service('class_resolver')-&gt;getInstanceFromDefinition('Drupal\mymodule\Form\Mymodule\SearchBlockForm');
$form-&gt;setFormIdentifier('some_custom_value');

return \Drupal::formBuilder()-&gt;getForm($form);


The key line of code here is this one:

$form-&gt;setFormIdentifier('some_custom_value');


If you pass a different value each time you generate the form, each form will get a different form ID. The form ID will be:

search_block_form-some_custom_value


Which will then be available in hook_form_alter with a $form_id of search_block_form-some_custom_value