We study the double heavy baryon and tetraquark production through photon-photon and photon-gluon fusion via ultraperipheral collisions at the LHC and Future Circular Collider (FCC) within the framework of nonrelativistic QCD factorization formalism. Various ion-ion collisions are taken into account, two -diquark configurations ( and ) and four -diquark configurations (, , , and ) are considered in the calculation. Numerical results indicate that the diquark provides dominant contribution for () production, and a considerable number of () can be produced. Because the event topologies for ultraperipheral collision are very clear, the background from various QCD interactions can be suppressed, hence the experimental investigation for and is feasible. The productions for are also discussed, leaving only a slight possibility for through photon-gluon fusion with ultraperipheral collisions at the FCC.