You use the expression ‘A Taste of Your Own Medicine’ to indicate that someone is

sampling the same unpleasantness they’ve been dishing out to others.

Example of use: “I don’t feel at all sorry that people are calling you names. You’re getting a taste of your own medicine.”

