The text is an idiomatic expression that advises against taking an action that would harm oneself in an attempt to get revenge on or thwart someone else. It does not play on different meanings of a word or similar-sounding words.
Don ' t cut off your nose to spite your face .