Which pipe do I need to link under sink trap and drain?
If you can’t get the tail out of the basin pop up /drain stopper you may need to replace the entire drain assembly.
Don’t panic only about 12.00$ at the big orange home store “pop up assembly” by easy flow is one inexpensive one that will work.
First remove the drain pop up lever unscrew the plastic and pull the rod out the back. the rod is held in place by a spring clip  now you can slid the rod off the clip
The basin nut at the bottom of the sink now needs to be unscrewed loosened.
Now comes a possible difference depending on type some the nut will come all the way off and the assembly can be pushed up.
The other way (most common) is the top section unscrews and when the flange is loose pull down and remove lift the top piece and stopper out and it is ready to be reassembled.
When you purchase the new piece if it doesn’t have a seal for the top (many come with a neoprene seal) you will need a small tub of plumbers putty.
Roll out a nice fat worm slightly longer than what it takes to wrap around the pipe at the top part (the flair that the stopper sits on) when snugged down plumbers putty squishes out and fills the voids creating a water tight seal of there is not a neoprene seal.
Other than that you can keep the existing piece to push and pull the stopper or remove and install the new one.
The stopper adjustment is the toughest part it may be slightly higher or lower than the original once adjusted I put the slip joint pipe to the P Trap and snug all the nuts. After doing this a few times it can be done in under 15 minutes, but the first time expect 30-45 minutes. A pair of plumbers players with the adjustable jaws that can open to 1-1/2” really makes the job much easier and is the only tool I usually use other than a screw driver to scrape any old plumbers putty away after removing the drain/ pop up assembly.
There may be some instructions make sure to look them over , if you have an over flow drain you will want to line up the holes with the drain.
I probably made it sound hard but really I have to pull mine apart several times a year because it gets plugged with long hair from the wife, daughters and all the granddaughters long hair they are not hard and if you can’t get the tail out or find a new one to screw in you will need to replace it.