Before you get too worried, you should know that Samsung phones like the Galaxy A51, secured by Knox, already come with protections against malicious sideloaded Android apps in place. Out of the box, Samsung devices already block sideloaded apps, so in order to override this safety net, you would need to go into your settings and enable special app access. For older versions of Android (7 and below), be sure to check the “Unknown Sources” box in your settings (Settings > Lock Screen and Security) menu. You'll be able to load any application once it’s turned on.
That said, instances that might require you to sideload an app are few and far between, so sticking with apps from approved app stores whenever possible is the best way to make every download a safe one.
For more on sideloading, visit Samsung Business Insights.