Possible worlds have been used as a way to understand modalities like necessity and possibility. For instance something is necessary if and only if it is true in all possible worlds. This is a way of trying to understand what it means to say that X is necessary.
More basically, you can use possible worlds to cash out the idea of an inference's being valid: the inference from X to Y is valid if and only if Y is true in every possible world where X is true.
Possible worlds have also been used to give a semantics for counterfactual conditionals, though this is more controversial. How do you evaluate conditionals like:
- "If I were to drop this glass, it would smash"
- "If I were to drop this glass, it would turn into a porcupine"
Now, as a matter of fact, I don't drop the glass. Thus the antecedent of both conditionals is false, so if they were material conditionals, both would be true conditionals. But intuitively, the first is true, the second false. So we need a better understanding of conditionals like this. David Lewis offered an account of what makes the first true and the second false in terms of possible worlds. The idea is that in the closest possible world where I drop the glass the glass smashes, and it does not turn into a porcupine. Thus the first conditional is true, the second is not. Obviously, the devil is in the detail and much ink has been spilled trying to get a handle on closeness of possible worlds. But the intuitive idea should be clear.
I don't think possible worlds fix a flaw or bug in logic: they are a neat conceptual tool to make understanding things easier.