Unable to use Node::load
use Drupal\node\Entity\Node;

function custom_autofill_reference_form_alter(&amp;$form, \Drupal\Core\Form\FormStateInterface $form_state, $form_id) {
  if ($form_id =='node_monitoring_report_form'){
    $field_school_information =  \Drupal::request()-&gt;query-&gt;get('field_school_information');
    $node_details = \Drupal\node\Entity\Node::load($field_school_information);
    $form['field_school_information']['widget'][0]['target_id']['#default_value'] = $node_details;
  }


}


Above code worked finally and it was showing error as I did not clear the cache while trying to check it out.