Use Hidden Nationality when you want to be able to fight but don't want to capture cities. A HN army can capture workers and settlers, pillage improvements and roads, and harass units moving around outside of the protection of cities.
You can use Veil of Night as a prelude to war (soften up the enemy by cutting off their supply of a strategic resource, or stage a surprise attack on their main army with the option to abort the war without diplomatic consequences if that important first battle goes poorly) or as a way to continue aggressions after the treaty has been signed (make peace but then trigger Veil of Night and harass the enemy to prevent recovery). I have also used it as a peacetime method to allow me to open my borders without enabling the other party to spread their religion in my territory.
As you mentioned, one of the dangers of using Veil of Night is that your friends may start killing your units. It is important to consider this factor, and either close your borders or cancel HN on units as is necessary to prevent unwanted conflicts from taking place. Hidden Nationality works very well with Nox Noctis (the CoE shrine), because your units can hide from the danger of friendly attackers without needing to cancel HN or close your borders, but are still at liberty to strike when you wish.