This is a challenging saying in its context. We use it all the time (out of context) to the point that casting pearls before swine is a cliché for us. It may have been a cliché for Jesus as well. Not sure about that.
On the surface, I’d be inclined to say that 7:6 tempers 7:1. That is, don’t judge, but also don’t go off the deep end and be indiscriminate either, or you will end up with pigs and dogs as your audience. There may be an element of that interpretation.
This verse also may be serving as a transition to more teaching about prayer coming up. The bit about giving children stones and snakes when they want bread and fish seems a bit parallel. I need to think about that some more.
Either way, I can say that we need to be careful and discriminate about how we use the holy things of God. We have a treasure of heaven in our midst and focusing on God is the most important thing. It’s easy to be distracted.