Will my actions still affect my companion's relationship even if they're far away?

Solution 1:

No, if your companions are not nearby they will not care about your actions. However, they don't necessarily have to be your current companion, even if you dismiss them and they are still around (it takes them a while to walk out of range) they'll approve/disapprove of what you do.

The exception being if you declare war on the faction that companion belongs to.