drupal 8 url::fromroute with params code example
Example: drupal 8 get argument from url
$current_path = substr(\Drupal::service('path.current')->getPath(), 1);
$path_args = explode('/', $current_path);
$current_path = substr(\Drupal::service('path.current')->getPath(), 1);
$path_args = explode('/', $current_path);