Of these two words, gaffe is much more common and is often misspelled as gaff, which is an uncommon word.
Gaffe, a noun, is “a mistake, especially a clumsy social or diplomatic action.” Gaffe can be used to describe almost any kind of mistake; however, it is most often used for mistakes of social or diplomatic behavior, such as calling a leader by the wrong title.
Gaff has many meanings, all referring to types of metal hooks, spears, and other sharp, pointy pieces of equipment, usually used in fishing. Most English speakers would think first of a large metal hook on the end of a pole. And gaff can be used as a verb meaning to use such a hook.
Gaff also has a meaning in British slang not used in America: “a music hall or theater with a bad reputation.”