Homonyms are words that are both spelt and pronounced the same, but have different meanings. You're probably talking about homophones/paronyms.