Never use $response->send() under any circumstances. This results in unpredictable behavior and might fail in different environments, when moving from dev to prod, for example, or in future updates, like it did for Drupal 9.2.
The correct method depends on where you want to use it:
In a controller:
In a form ...
Using redirects with $response->send() like this used to work:
$response = new RedirectResponse($url);
But, this no longer works in Drupal 9.2. Also, it breaks JSON:API in versions before 9.2. The correct way to do it is described in detail in this excellent answer.
Basically, you need to create your own custom http_middleware ...