The five Sarnei Pelishtim were in Ashdod, Azah, Gas, Ashkelon and Ekron (Yehoshua 13:3). Yehudah conquered Azah, Ashkelon and Ekron (1:18)!
1.
Radak: Yehudah conquered them, and afterwards the Pelishtim took them from them. "Heni'ach Hashem" (verse 1) includes places that Yisrael never conquered, and places that they conquered, and Hashem let the Nochrim take it back.
2.
Malbim: Azah, Ashkelon and Ekron they conquered after Yehoshua died
1
and the others they did not conquer, and needed to fight them.