Ideally you want to go to a shelter first, because if a shelter is dangerous or unclean you can just leave (unlike jail). If you can’t find a shelter that has space for you, the next best thing is to sleep somewhere visible but somewhat sheltered and out of the way. Church doorways are ideal since if they find you they will usually offer you help rather than call the cops on you.
If none of those avenues are available to you, hit up your local library. If they don’t outright have a social worker on staff they’ll know how to put you in contact with one and help you with applying for benefits that can at least keep you fed, and will hopefully know how to most effectively get you in line for housing.