How to load a node by a field value?
The quickest way to load a specific node by field value is to use the method loadByProperties().

You specify one or more field values and returned is an array containing the nodes matching the field values:

$nodes = \Drupal::entityTypeManager()
  -&gt;getStorage('node')
  -&gt;loadByProperties(['title' =&gt; $title]);


Normally you loop over the nodes. In your case you are looking for one specific node. A single node is also returned in array, so apply reset() and this returns either the node or NULL if nothing was found:

if ($node = reset($nodes)) {
  // found $node that matches the title
}