In this manuscript, we have shown the growth and extensive structural and optical characteristic of the uniformly Mg-doped Al0.23Ga0.77N (UV-A region, λ ∼ 323 nm) nanowire. The Kelvin probe force microscopy was employed to determine the profile of holes in p-type AlGaN nanowires by measuring the work function changes induced by Mg incorporation. The influence of surface band bending on doping concentration has thoroughly been discussed. Our experiment confirms the homogeneous incorporation of Mg throughout the nanowire without any top surface Mg segregation. In this work, we have also demonstrated a comprehensive analysis of acceptor states induced thermal quenching behaviour in the optical transition of Mg-doped AlGaN nanowire. We propose a phenomenological model, based on the rate equation which confirms that achieving higher ‘hole’ (p-doping) concentration in AlGaN nanowire (>1018 cm−3) is more conducive than the planar counterpart if the growth of NWs is carried out at optimized process conditions. This rate equation-based model has also demonstrated the influence of sidewall surface passivation in those AlGaN nanowires.