It would depend on the person, the reason, the timescale and amount of space I had.
I have a friend who has twice lived with me the first time was planned - it was for around 6 weeks, and she paid rent. The second time was an emergency situation - I offered her a place to stay temporarily - this was intended to be for a few days while she worked out what to do. In the end , it was for about 6 weeks, but after the first week she paid rent.
When I made the offer, I knew what I was letting myself in for as she'd lived with me previously, so I knew that , while there were things which would bug me, there was nothing I couldn't live with on a temporary basis (She was a considerate guest / lodger, but I think there are always irritations when you're sharing your space)
I wouldn't hesitate to let any member of my immediate family stay if they needed it - whether/how much rent would depend on why they needed the space and how long they were staying - I probably wouldn't ask for rent if they were there for less than a month, but if they were there for more than a few days would except a contribution towards the cost of food etc. so I wasn't out of pocket - but with my family, I probably wouldn't have to ask.
Friends - would depend who and why. My BFF did move in with me when she separated from her boyfriend - but it wasn't an emergency so the move was planned, and she paid rent - she lived with me for about 8 months and I'd be happy to have her do so again any time - we go back a very long way, holiday together, and know we can get on well in the same house.
I do value my privacy, however, so anyone else I'd probably limit it to few days. If I didn't have a spare room, then it would be max. 1 night, I think.