The commands (
sudo -i) in and of themselves aren't necessarily harmful. However they do different things in terms of granting permissions to apps.
sudo ("substitute user do") command allows you to run a process as another user, typically the
root user. That is, by default it runs the process as a user with unlimited power.
When you use
pkexec, you're using PolicyKit. PolickyKit is the part of the system that keeps track of the types of privileges that certain users and programs should have. It depends on certain policy files being defined that describe these privileges. A policy for Ubuntu Software Center, for example, would grant permission to use
apt, but it wouldn't necessarily grant permission to change network settings. This kind of control is what the documentation you referenced means by "minimal known and safe environment". The intention is that PolicyKit does not grant more permissions than are necessary.
Why does this matter to you and is it really less safe to run with sudo?
This depends on both the policy written and the app itself. For an app like Files, running with elevated permissions can be pretty dangerous in any case. But imagine that Files had permission to do things you would never want it to do, like create or delete user accounts. Since Files can have 3rd party plugins, imagine that a malicious third party plugin exists that runs in the background and tries to delete accounts. If you've installed software from a PPA or from a downloaded deb, you could already be infected with this type of malware. With a strong PolicyKit policy, Files would never be able to take this action, rendering the malware ineffective. But with
sudo, it would have full permissions to make this malicious change.
But what if the policy isn't strong?
It's true that a policy can be written to essentially do the same thing as
sudo. However, policies are managed as part of the system's security updates. So running an app with
pkexec can actually get more secure over time with updates as stronger system policies are written. Using
sudo will always grant full permissions.