Convert node ID from string to integer
the $query-&gt;execute(); return an array of key/value like [KEY =&gt; nid1]:
if you are sure you have only one node with that tittle you should get the first element of the array it's your nid try with:
 $query = \Drupal::entityQuery('node')
  -&gt;condition('type', 'my_content_type')
  -&gt;condition('title', 'my node title');
$nids = $query-&gt;execute();
// Get the nid in the array.
$nid = reset($nids);
$node = Node::load($nid);