How to get nid and title from a node array
As mentioned in the comment of @Hudri Node is an object not an array.

In Drupal 8 there are two ways to get the value of a field.


$node-&gt;field_name-&gt;value 
$node-&gt;get("field_name")-&gt;getValue()


In your case you can get the nid and title like below:

$nid = $node-&gt;id();
$title = $node-&gt;label();


or

$title = $node-&gt;getTitle();


To read about objected-oriented programming conventions In Drupal 8 check this blog article: Drupal 8 API: objected-oriented programming conventions.