Apps like IRoot are known to slap advertising (and "phone home with your data") apps on the phone while they're rooting.
If you can unlock the bootloader (some Samsung phones, notably bot ones made for the US, can have their bootloaders unlocked), see
this page to install TWRP, then try installing
Magisk (in TWRP, using its Install function). It's a systemless root, so you can update easily, it doesn't install anything but itself (but there's a whole
Magisk-Modules-Repo full of things you
can install once you've installed Magisk), and it's developed by a trusdted XDA developer, so you can trust it.
(
Don't install SuperSU, which the page tells you to do, just install TWRP.)
Unlocking the bootloader will wipe the phone, but since you installed a new ROM, you probably have backups of anything you need to keep (or you know how to make them). (By the way, if you're reflashing the ROM, you don't have to do a factory reset - the installation will reset ore than a factory reset will.)
If you can't unlock the bootloader, you'll have to use Odin to install SuperSU, so see
this page. That also won't install anything but itself. (Trusted developers quickly become untrusted developers if they try tricks like that.)