How can I find leaf and orphan packages?
Install the dnf-utils package if you don't already have it:
dnf install dnf-utils
Then you can run:
List leaf nodes in the local RPM database. Leaf nodes are RPMs
that are not relied upon by any other RPM.
List installed packages which are not available from currently
Its not automatically safe to erase the packages you find.