Effective Hamiltonian for near-degenerate states in relativistic direct perturbation theory. II. H2+-like systems