Programmatically using values from a loaded entity inside a message
As Clive also mentioned use double quotes instead of single quotes to allow the variables to get replaced inside the string

'body' =&gt; "Hello $nodeowner this is your body message"


if $values["selected_node_owner"] gives you the UID here is how to get the username

$account = \Drupal\user\Entity\User::load($values["selected_node_owner"]);
$nodeowner = $account-&gt;getUsername();