When I click on the column header of Grid view, it is getting sorted, and in the URL sort parameter is gettting passed like page/index?id=12&sort=column1. I want to add another parameter while sorting like this page/index?id=12&sort=column1&custom_id=2.
Please help me on this
You can configure it in your DataProvider using sort params like this:
Note that according to this official documentation if you set params explicitly - sort links won't have request's context GET params.
So you if you want your filter to persist you should merge $_GET array with your custom params injected to the link.
The example with merged $_GET: