How do I fetch the ID from the URL? I have a view which has 2 displays i.e 'page' and 'attachment'.

I am trying to fetch the id from the url and want to display it on 'attachment' display but having difficulty.

On the 'attachment' display, I want to display a text with link to another page alongwith the url id.

If I use 'Contextual filters' then what is the next step to display above text alongwith this id as  tag? or perhaps any other solution.
I found following solution which works for me.....

VIEW > ADVANCED > Contextual filters

Add filter and look for WHEN THE FILTER VALUE IS NOT IN THE URL section.

Select 'Provide default value' > Type: Raw value from url > Path component: ____ (set url id value path number)

e.g if this is url, to get 239066 I will set Path component: 3

(https://drupal.abc.com/questions/239066)

VIEW > Attachment settings > HEADER > Add: Text area > Replacement patterns section will display your url id i.e {{ arguments.url_id }}