You are allowed to reuse ideas, but you are not allowed to reuse exact characters, names, or blocks of text.
Let's take The Lord of the Rings as an example. You're not allowed to use the character Gandalf, but you can certainly use a wizardly mentor figure. You can't use Frodo or Sauron, but if you want to have a peace-loving hobbit go on a quest to destroy the evil dark lord by throwing a magic ring into a volcano, you can do that. You might be thought derivative, but you're not guilty of plagiarism.
(You'd probably want to avoid the word "hobbit" in your work. This term was created by Tolkien, and may or may not have become sufficiently general over time, but it would probably take a court case to decide for certain. When Dungeons & Dragons adapted much of Tolkien's world, they changed the name of their hobbit race to 'halfling' for legal reasons. But words like 'elf' and 'dwarf' were perfectly fine to keep, because they weren't Tolkien originals.)
I like using The Lord of the Rings as an example for these types of questions, because there's a very successful series whose first book, The Sword of Shannara, basically ripped off the plot and characters of The Lord of the Rings wholesale, and doing so was perfectly legal. Terribly derivative, in my opinion, and not really a very good book; but it achieved a significant measure of commercial success nonetheless.
In practice, you don't need to worry about legal issues just because you "cannot stop feeling that [you] have read that before somewhere else" provided that you don't literally use the same names or characters. Seriously, if you're worried, go track down a copy of The Sword of Shannara (your local library probably has a copy) to get an idea of just how far you can push the envelope without any legal ramifications whatsoever.