Load an object from the current request

This is formerly known as menu_get_object().

Load a node from the request

$node = \Drupal::request()->attributes->get('node');
dump($node);

// Returns null or a node object.

Load a user from the request

$user = \Drupal::request()->attributes->get('user');
dump($user);

// Returns null or a user object.