I heard it should match the religion of the listener. For example, salam alaykum to a muslim, sat sri akal for a sikh, je ram ji ki / ram ram for a hindu...
namaste / namaste ji / namaskar - i think this is the most common formal and non religious option...
Please correct me if I am wrong or forgetting an important one