Very carefully, YOU can melt out the old caulked joint AFTER airing ( venting) out the sewer piping so it doesn’t explode from various sewer gasses
You can also use a Cast Iron inside cutter and cut just below the caulked joint THEN install another LONGER caulked joint using oakum and molten lead. A
Quick set” flange will not work properly on Extra Heavy Cast Iron or Galv steel/wrongt iron has a larger wall thickness than NHCI Quick set type. Good Luck WEAR Safety glasses and a mask