I have a leak in the trap underneath my bathtub. Specifically, the leak is happening at the union nut of the trap (see red circle in picture). I have confirmed that the nut at the union does not tighten and is busted meaning I will need to replace the entire trap. Since the pipes are ABS and thus are sealed with ABS cement, I am assuming they are not removable thus requiring me to cut them off the input and output pipes (see yellow dotted lines).
Does this seem like the right approach? My concern is that after I cut off the P trap, a replacement P trap will not align correctly with the existing input and output pipes since it will have to be fitted higher than the old trap. What is the correct solution to have the replacement trap match the heights of the input/output pipes?