Your two examples are not given in the same place, so they need not convey the exact same message.
Mat 7:6 - Give not that which is holy unto the dogs, neither cast ye your pearls before swine, lest they trample them under their feet, and turn again and rend you.
Swine do not ask for pearls. Dogs do not ask for that which is holy.
Mat 15:22 - And, behold, a woman of Canaan came out of the same coasts, and cried unto him, saying, Have mercy on me, O Lord,
thou Son of David; my daughter is grievously vexed with a devil.
Mat 15:23 - But he answered her not a word. And his disciples came and besought him, saying, Send her away; for she crieth after us.
Mat 15:24 - But he answered and said, I am not sent but unto the lost sheep of the house of Israel.
Mat 15:25 - Then came she and worshipped him, saying, Lord, help me.
Mat 15:26 - But he answered and said, It is not meet to take the children's bread, and to cast
it to dogs.
Mat 15:27 - And she said, Truth, Lord: yet the dogs eat of the crumbs which fall from their masters' table.
Mat 15:28 - Then Jesus answered and said unto her, O woman, great
isthy faith: be it unto thee even as thou wilt. And her daughter was made whole from that very hour.
Yet a dog will ask for bread. It would be wrong to feed dogs before children, but that doesn't mean dogs who beg can't be fed.
Mat 7:8 - For every one that asketh receiveth; and he that seeketh findeth; and to him that knocketh it shall be opened.
In context 'dogs' and 'swine' refer only to the Gentiles of Jesus' day, as compared with the Jewish people to whom Jesus was originally sent. Ever since the stoning of Stephan that distinction no longer applies. If you as a Christian desire to look down on other people as subhuman dogs or swine, then that vanity is on you.