Drupal - Verify a node with a given node ID exists
If you don't want to load the entire node then you can use entity query:
$values = \Drupal::entityQuery('node')->condition('nid', $id)->execute();
$node_exists = !empty($values);
This will be much more efficient because it only asks for the ids and not all the node fields.
You can pass the nid to \Drupal\node\Entity\Node::load(). It will return an object if it exists, NULL if it doesn't.