How to access values in node object?
There are several options:

You can use the getter method for the node id (available for all entities):

$node-&gt;id()


You can use magic methods to access any field of any content entity:

$node-&gt;nid-&gt;value


The above code will actually trigger the below:

$node-&gt;get('nid')-&gt;get(0)-&gt;get('value')-&gt;getValue()