  We study an inhomogeneous three-orbital Hubbard model for the Cu-substituted iron pnictides using an extended real-space Green's function method combined with density functional calculations. We find that the onsite interactions of the Cu ions are the principal determinant of whether an electron dopant or a hole dopant is caused by the Cu substitution. It is found that the Cu substitution could lead to a hole doping when its onsite interactions are smaller than a critical value, as opposed to an electron doping when the interactions of Cu ions are larger than the critical value, which may explain why the effects of Cu substitution on the carrier density are entirely different in NaFe$_{1-x}$Cu$_x$As and Ba(Fe$_{1-x}$Cu$_x$)$_2$As$_2$. We also find that the effect of a doping-induced disorder is considerable in the Cu-substituted iron pnictides, and its cooperative effect with electron correlations contributes to the orbital-selective insulating phases in NaFe$_{1-x}$Cu$_x$As and Ba(Fe$_{1-x}$Cu$_x$)$_2$As$_2$. 
Localization and Orbital Selectivity in Iron-Based Superconductors with   Cu Substitution