C (gcc), 93 93 92 bytes
-1 Byte thanks to ceilingcat
D;I;C(N){N=N?C(N/10)+(N%10==D):0;}F(N){for(D=I=0;D<10;C(N)>C(I*I)+C(I*I*I)?D=!++I,D=0:++D);I=I;}
ungolfed:
int D;
int I;
int CNT(N) // count occurrences of digit D in number N
{
if (N)
return CNT(N / 10) + (N % 10 == D);
return 0;
}
int F(N)
{
for (D = I = 0; D < 10; ++I)
{
for (D = 0; D < 10; ++D)
if (CNT(N) > CNT(I * I) + CNT(I * I * I))
break;
}
return I-1;
}