أَيَا مَوْلَايَ
O my master!
The particle presents a respected, high-ranking person as if remote. The important clue is difference of status, not any assertion that the person must stand far away.
يَا اللَّهُ
O Allah!
In supplication, yā does not imply spatial separation from God. It expresses direct appeal and humility. Both examples show that speaker–addressee relationship matters in interpreting the chosen vocative form.