Cthulhu d20 has a magic system in which spells aren't tied to classes nor to levels. Anyone can learn and use a spell, if they're willing to pay the price, which usually comes in the form of a temporary or permanent ability loss (drain) plus a loss of Sanity points, besides whatever in-game consequences the DM sees fit.
This system, in my opinion, would work extremely well fluff-wise in a dark fantasy D&D 5e world as well — such as Ravenloft / Curse of Strahd, for example — either as an add-on besides the standard magic system or as a full replacement of that system. Let's focus on the previous, though:
What are the most obvious pitfalls of introducing the magic system of Cthulhu d20 into D&D 5e as an add-on, making cost-based spells available to practically anyone who has the chance to learn them in-game; and what are the best ways to avoid those pitfalls when integrating the two systems?
Would such a merger break the game? What steps and rule tweaks would ensure the smoothest possible extension of the core D&D 5e system? (Sanity would have to be used, obviously, as per the 5e DMG.)
Note, please, that there's another similar question out there on the site (which was also asked by me :)) about 3.x and the same Cthulhu d20 systemabout 3.x and the same Cthulhu d20 system. However, what I'm asking here is not the same (though even if I did that, the answer would have to be different, considering the difference between 3.x and 5e.) What I'm asking here is how to best port the complete spells section of CoC d20 into 5e as an addendum to work alongside the official magic rules, which would not be affected by the levelless cost system. Please, detail the major pitfalls your proposed solution helps avoid. (Nonetheless, it would be interesting to see a wizard who used both the leveled, costless spells and the levelless, costly ones. :))