Illusion doesn't stop working, but it does hit a wall around your level because you're not investing in the perks that make it scale. Fury and Mayhem are the flashy early spells, yeah, but they cap out hard without the right perk tree support.
The real issue is that enemy resistances and spell effectiveness scale with your level, and Illusion's perks are what close that gap. You need to grab the perk that boosts the magnitude of your spells (there's one early in the tree), and more importantly, you need Quiet Casting and the perks that reduce spell costs. Illusion is expensive mana-wise, so if you're running dry mid-dungeon, it feels useless even when it's technically still working.
Also - and this matters on Switch - make sure you're actually hitting enemies with the spell. Some people don't realize Mayhem has a range limit, and if half your targets are outside it, the spell looks broken when it's just not reaching them.
If you want to keep it viable past 22, you've got two paths: either keep leveling the tree and accept you'll be a support caster (control the room, let your followers or summons do damage), or pivot to a hybrid build where Illusion softens enemies up and you finish with melee or another school. Pure Illusion damage builds are rough on higher difficulties, not gonna lie, but as a control tool it's still one of the best things in the game.
What difficulty are you playing on?