In this paper, we perform a comparative analysis between the future proposed long-baseline experiments ESSnuSB and T2HK in measuring the leptonic CP phase $delta_{rm CP}$. In particular, we study the effect of the neutrino mass ordering degeneracy and the leptonic mixing angle $theta_{23}$ octant degeneracy in the measurement of leptonic CP violation and precision for both experiments. Since the ESSnuSB (T2HK) experiment probes the second (first) oscillation maximum to study neutrino oscillations, the effect of these degeneracies are significantly different in both experiments. Our main conclusion is that for the ESSnuSB experiment, the information on the neutrino mass ordering does not play a major role in the determination of $delta_{rm CP}$, which is not the case for the T2HK experiment. However, the information on the true octant compromises the CP sensitivity of the ESSnuSB experiment as compared to T2HK if $theta_{23}$ lies in the lower octant. These conclusions are true for both the 540~km and 360~km baseline options for the ESSnuSB experiment. In addition, we investigate the effect of different running times in neutrino and antineutrino modes and the effect of $theta_{23}$ precision in measuring $delta_{rm CP}$.