The pKa1 and pKa2 values of H2CO3 are quite distinct and so when a carbonate solution is titrated against hydrochloric acid, there occur two distinct regions of sharp pH change. The first corresponds to the formation of HCO3- (pH 8 to 10) and the second due to complete neutralization at pH 4-6. The first is in the pH range in which color of phenolphthalein changes from red to colorless and the second is that at which methyl orange changes from yellow to orange red. The sharp change of pH occurs over a range of pH that includes the regions of color change of both the indicators, so both of them give the end point correctly.
So When we have both sodium carbonate and sodium hydroxide present together in a solution, a titration using phenolphthalein gives the titre (volume at the equivalence point) corresponding to sodium hydroxide plus half the carbonate and the titre obtained with methyl orange corresponds to the total alkali. The individual sodium carbonate and hydroxide concentrations may be calculated from the data.