For Lemmy, if nobody is subscribed to that community on your instance you have to copy the entire URL. E.g. you need to search for https://instance.social/c/sub in order to find !sub.
Once one person on your instance searches for it, then you can find it by searching !sub.
I don't know why Lemmy works like that. Kbin doesn't have the problem; you can find things by searching @sub@instance.social no matter what.