Founder and flounder are often confused, and many people tend to think of them as synonyms that can be used interchangeably. Not quite.
Both founder and flounder can be used as nouns, but what gets confused (and what this answer is concerned with) is the meaning of the words when used as verbs.
The origin of founder can be found in Latin, where it comes from fundus, a word meaning "bottom." Founder, when used as a verb, literally means "to fill with water and sink" or "to cave in."
Example: Mulder lost his proof of the lake monster's existence when a strong rain foundered the tiny boat he had rented.
It's also used metaphorically to describe something that has completely and utterly failed, such as a project or task.
Example: All of Mulder's attempts to prevent the boat from sinking foundered badly.
If you're talking about horses, "founder" will mean to stumble or go lame, but that is a usage reserved to refer specifically to horses.
Flounder, in contrast, doesn't seem to have such a clear origin, and in fact it may have actually come about through confusion with "founder." But however suspect its origins, the word has evolved to mean something distinctly different.
Flounder, as a verb, means "to struggle or thrash about," "to move or act with confusion or clumsiness," or "to have trouble with."
Example: Mulder floundered as he tried to explain to Scully why he'd lost the deposit on the boat.
A way to remember the definition of "flounder" is to think of the noun definition: a flounder (type of fish) out of water will flop around desperately, or flounder.
You can think of "flounder" as weaker than "founder." If you're trying to complete a task and floundering, then you still have a chance to pull it together. But if your task is foundering, then it has failed beyond salvation.