With the discovery of two-dimensional materials like graphene, the relativistic two-dimensional Dirac equation has garnered increasing attention from researchers. Accurately solving the Dirac equation in electromagnetic fields is the foundation for studying and manipulating quantum states of Dirac electrons. Sectioned Series Expansion method is successful and accurate in solving Schrodinger equation under complex electromagnetic fields. Dirac equation is a system of coupled first-order differential equations with undermined eigenvalues, more difficult to solve. By applying the sectioned series expansion principle to Dirac equation and conducting series expansions in regular, Taylor and irregular regions, we obtain an accurate method with wide applicability. With the method a universal criterion for bound states of Dirac electrons in electromagnetic fields has been derived and the energy levels and wave functions of bound states can be accurately calculated.The criterion provided by Equation (52) shows that the magnetic field and mass field help to confine Dirac electron while the electric field tends to deconfine it due to Klein tunneling. When the highest power of the electric potential is equal to that of the magnetic vector potential or the mass field, confined-deconfiend states depend on the comparison of their coefficients. We apply the method to two cases: one is massive Dirac electron in Coulomb electric potential (relativistic two-dimensional hydrogen-like atom) and the other is Dirac electron in uniform mangetic field (mangetic vector potenial is A=1/2Br) and linear electric potential V=Fr. The energy levels of the hydrogen-like atom are calculated and compared with analytical solutions, demonstrating the exceptional accuracy of the method. By solving Dirac equation under uniform magnetic field and linear electric potential, the method proves to be broadly applicable in the solutions of Dirac equation under complex electromagnetic fields. Under uniform magnetic field B and V=Fr, as the F increases, level orders of negative energy states change and at the critical point F=0.5B, the bound states of positive ones still exist while only certain negative ones can exist on the condition that their energies exceed zero. The sectioned series expansion method provides an effective computational framework for Dirac equation and it deepens our understanding of relativistic quantum mechanics.