In these passages is the account of Israel driving out more inhabitants (Canaanites) and occupying the land. However, Israel did not drive out all the inhabitants as God commanded. The inhabitants that remained eventually became a snare to Israel with their demonic worship and practices.
These passages note that Israel obeyed God while Joshua was alive, and while the elders who witnessed God’s miraculous work in Israel were alive. However, when the first-hand witnesses died, Israel began to move away from God.
These passages can be applied to our lives today. The Canaanites caused Israel to retain or harbor sin in their lives. If we harbor sin, we cannot expect God to continue to bless us. We must repent of our sins and strive to rid ourselves of them.
Sin will move us away from God. The Bible says that God will not hear the prayers of sinners. Therefore, we must remove sin from our lives if we want to draw close to God.