What is the term for words that sound the same but are spelled and defined differently?

They are called homophones but not homonyms, because homonyms are two words which have the same pronunciation and spelling but differ in meaning.
They are homophones.