We have Jesus's word that the gates of hell will not PREVAIL against the Church He founded.
Yes, but there will be a huge falling off (2 Thess. 2), the abomination of desolation will stand in the holy place (Mt 24), the continual sacrifice shall be taken away (Mt 24,15 => Dan 12), and the rest of the holy people will be scattered (Dan 12). In the last days before the return of Christ there will be a time of tribulation as never has been before (Dan 12).
St. John Chrysostom in the Opus imperfectum on Matthew in Homily XLIX on Mt 24 says that the destruction of the Church will parallel the destruction of Jerusalem A.D. 70. The hosts of Titus in A.D. 70 are hosts of heretics at that time. Most Jews were killed in A.D. 70, and the rest scattered all over the world. Most Catholics will be spiritually killed at that time, and the rest scattered all over the world.
Looks to me like what we see today.
Yes, the gates of hell will not prevail against the Church. But only a small number of believers will be left: "And unless those days had been shortened, no flesh should be saved: but for the sake of the elect those days shall be shortened." (Mt 24,22)