Do you want to know how to Drupal?

Let's Drupal

How to redirect user to custom URL programmatically in Drupal 9?

$response = new RedirectResponse($your_custom_path);
$response->send();
return;