As @Sasha mentioned in their comment, there's no word that is used only when addressing. Likewise in English, historically, "sir" used to mean, "owner, master, landlord". However, you no longer say, "this sir did X". The same applies to Ukrainian.
Also, one should keep in mind that the perception of bourgeoisie was spoiled during the centuries of effective occupation of Ukraine.
Having this said, the words you're looking for are,
and its corresponding Vocative forms, пане and пані.
СУМ gives the following meaning to пан:
- In old Poland, Lithuania, before-revolution Ukraine, and Belarus — a respectful/noble form of addressing or referring to men of higher segments of society.
// Nowadays — respectful form of referring or addressing, usuially to an official person or a foreigner.
// (ironical) A person who is not respected or their behavior is contempted
Mind the latter item.
The dictionary article for the corresponding feminitive, пані, is essentially the same.
The usage is pretty similar to the English one:
- Пане поліцейський, дозвольте запитати… — Mr. officer, may I ask… (with known name, profession, or occupation)
- Пані, чи не могли б ви допомогти… — Ma'am, could you help… (if you don't know the name or occupation)
Update. In their comment, @Sasha and @OksanaGubrenko have listed several other words worth mentioning and worth using in practice:
- добродій (noun, m.; voc: добродію), добродійка (noun, f.; voc: добродійко);
- шановний (adj, m.), шановна (adj, f.).
This is an Adjectival Noun or Nominalized Adjective — an adjective which has come to function as a noun, as in "the rich and the poor"
The шановн- adjective means "respected" and can be used either per se, or together with пан-/добродій-.
- also, a relic of Soviet-style, literally "comrade": товариш (noun, m); the fem. can be either товаришка or just товариш; voc: товаришу, товаришко.