The accurate identification of water‐bearing structures is urgently required for the safe construction of tunnel engineering. Currently, the direct current resistivity method is an effective method for detecting water‐bearing structures in tunnels. In the advanced detection of the direct current resistivity based on the finite element method, the traditional hexahedron mesh performs poorly for the discretization of models of complex tunnel structure sections such as horseshoe‐shaped and round sections. Therefore, this study adopts unstructured grid generation technology combining tetrahedra and hexahedra to achieve more accurate modelling of complex structures, such as round and horseshoe‐shaped sections, and establishes a forward modelling method of the direct current resistivity in tunnels based on an unstructured mesh. The maximum error between the numerical simulation and theoretical results for an infinite tabular body in full space is less than 0.8%. It is more complicated to calculate the sensitivity matrix and model constraint term for the inversion region containing two types of grid than for one. For this purpose, the sensitivity matrix of different types of grid areas is calculated, a model constraint term based on the dual constraints of volume and distance is constructed, and finally, a partitioned domain‐weighted least‐squares inversion method based on an unstructured mesh is proposed. Synthetic examples of typical water‐bearing structures are analysed, and the results show that the proposed forward and inverse methods of the direct current resistivity in tunnels based on an unstructured mesh can effectively capture the position and morphology of the water‐bearing structure. Finally, an on‐site application was conducted in the Yellow River Diversion Project in central Shanxi. The proposed method could effectively identify the water body in front of the tunnel face and guide the on‐site construction of the project. These results can improve the interpretation of the direct current resistivity data in tunnels and play a positive role in promoting the use of the direct current resistivity method to prevent and control water‐inrush disasters in tunnels with complex structures.