You can claim an individual on your tax return, including a friend or a relative, as long as they meet the criteria for a qualifying child or relative, and are not being claimed by anyone else in the same year.
In order to claim someone as a qualifying child or relative, they must also be a US citizen or resident, and must not be filing a joint return. For example, if your 18 year old child is married, but lives with you, you cannot claim them if they file a return jointly with their partner.
Next, you’ll need to determine if they fit the criteria for a qualifying child or relative.
A qualifying child must be related to you (step and foster children count), must be younger than 19 (or 24 if enrolled full-time in school), live with you for more than half the year, and depend on you for more than half of their support. If the child is disabled, the age limit requirement is waived.
A qualifying relative must live with you or fall on the list of relatives who do not have to live with you, found in Publication 501. They must have made less than 4,400 in 2022, and depend on you for more than half of their financial support. So, if a friend lived with you in 2022, did not work (or did and made under $4,400), and you financially supported them, you may be able to claim them as a dependent on your tax return.