Aims. The goal of this research is to study how the fragmentation of planetary embryos can affect the physical and dynamical properties of terrestrial planets around solar-type stars. Our study focuses on the formation and evolution of planets and water delivery in the habitable zone (HZ). We distinguish class A and class B HZ planets, which have an accretion seed initially located inside and beyond the snow line, respectively. Methods. We developed an N-body integrator that incorporates fragmentation and hit-and-run collisions, which is called D3 N-body code. From this, we performed 46 numerical simulations of planetary accretion in systems that host two gaseous giants similar to Jupiter and Saturn. We compared two sets of 23 N-body simulations, one of which includes a realistic collisional treatment and the other one models all impacts as perfect mergers. Results. The final masses of the HZ planets formed in runs with fragmentation are about 15–20% lower than those obtained without fragmentation. As for the class A HZ planets, those formed in simulations without fragmentation experience very significant increases in mass with respect to their initial values, while the growth of those produced in runs with fragmentation is less relevant. We remark that the fragments play a secondary role in the masses of the class A HZ planets, providing less than 30% of their final values. In runs without fragmentation, the final fraction of water of the class A HZ planets keeps the initial value since they do not accrete water-rich embryos. In runs with fragmentation, the final fraction of water of such planets strongly depends on the model used to distribute the water after each collision. The class B HZ planets do not show significant differences concerning their final water contents in runs with and without fragmentation. From this, we find that the collisional fragmentation is not a barrier to the survival of water worlds in the HZ.