(たんご) A single-kanji word, such as  犬, or a hiragana word like イヤ. But compound words or long-ass words are not 単語.
(ことば) ANY word – including compound words, or onomatopoeia. Also 言葉 can mean “way of speaking.” There are expressions like “watch what you say!” that use 言葉 this way:言葉使い が丁寧 (her way of speaking is very polite!) or 言葉大切につかいましょう (let’s be careful how we speak!)