Conditional form states in hook_form_alter()
This is a little bit tricky the Form API #states works with jQuery selectors if your filed field_openbaar_vervoer coming from a taxonomy entity reference.
So the input generated HTML will be something like (example from tags fields)
&lt;input data-drupal-selector=&quot;edit-field-tags-3&quot; aria-describedby=&quot;edit-field-tags--description&quot; type=&quot;checkbox&quot; id=&quot;edit-field-tags-3&quot; name=&quot;field_tags[3]&quot; value=&quot;3&quot; class=&quot;form-checkbox&quot;&gt;

So to target all those inputs you should use Starts With Selector in your code and it will work:
$form['field_afstand']['#states'] = [
  'visible' =&gt; [
    ':input[name^=&quot;field_openbaar_vervoer&quot;]' =&gt; ['value' =&gt; '236'],
  ],
];