The safest thing you can do in Indonesian is stop using pronouns for the person in front of you and use a title instead. It sounds warmer, it avoids every register trap, and it is what Indonesians do with each other.
The four
Bapak, shortened to Pak, for a man older than you or in a position of authority.
Ibu, shortened to Bu, for a woman older than you or in a position of authority.
Mas for a man around your own age.
Mbak for a woman around your own age.
Pak and Bu are the shortened forms you will hear almost exclusively. Bapak and Ibu also mean father and mother, which tells you exactly how much respect they carry.
Using them instead of you
Pak mau ke mana? ‘Where are you going, sir?’
Bu sudah makan? ‘Have you eaten, ma’am?’
There is no word for ‘you’ in either sentence. To an Indonesian ear this is more polite than any pronoun could be.
Using them with names
Titles go in front of the first name, not the family name.
Pak Budi, Bu Siti, Mas Andi
Calling someone Pak Wijaya by their surname is a foreigner move. Indonesia uses first names, and many Indonesians have only one name.
When you are not sure
Round up. Addressing a thirty-year-old as Pak is mildly formal and completely safe. Addressing a fifty-year-old as Mas is over-familiar and lands badly.
In a warung, a shop, or with a driver, Pak and Bu are never wrong.
What you’ll actually hear
Younger Indonesians in cities use Mas and Mbak for almost everyone in service situations, regardless of age, the way English uses “mate”. Follow what you hear locally rather than applying the age rule rigidly.