Welcome Developers,
In this situation, a class QueryParam.php is there which consists many useful methods for getting and checking the query params.
You can get the instance of query-params from request object.
$user_id = $request->query_params()->get('user_id);
If user_id query param doesn't exist in url it will return null.
Same way you can get the query params from any url.
Read this:-
https://trishulapi.com/docs/v1x/Http/Request.php