God put the Philistines right next to Israel

Amos 9:7 “Are not you Israelites
the same to me as the Cushites[c]?”
declares the Lord.
“Did I not bring Israel up from Egypt,
the Philistines from Caphtor[d]
and the Arameans from Kir?

God brought the Philistines from Caphtor and put them right next to His people Israel to use them as discipline and punishment for the disobedience of his people whenever He needed to. That’s why it’s always good to turn your heart to God first because sometimes He uses your enemies to get you in line.