Sam’s in his mid-20s, give or take a couple of years, and has attended the hospital where I work six times in the last four months. He’s alright, he reckons, but he’s got a skin infection on his foot that just won’t shift. I have another look at his foot, send some skin swabs to the lab and we try a different kind of dressing on it.

I prescribe another course of antibiotics for this recurring skin infection, but the reason it persists is because Sam’s sleeping on the floor outside a tube station, not a lack of medication. He tells me that his family are hundreds of miles away, that his mates just don’t have any space for him, that he can’t go back to a hostel because it’s just too difficult for him to avoid alcohol there, that he’s fed up and has exhausted all available options.

Sam’s not unwell enough to warrant admission to hospital and we’re packed to the rafters as it is, so I have to discharge him. I see Sam on the street as I walk home a few hours later and know he’ll be back soon enough. The antibiotics are futile when he’s lying in a damp sleeping bag on a pile of cardboard, which is how he acquired the foot infection in the first place.

Someone like Sam comes to our A&E most days, looking for help. Registering with a GP without a fixed address can be tricky and so homeless people will often access healthcare services via emergency routes rather than through community services. Sam could be the man in his 60s who attends hospital every couple of weeks, laden with three suitcases, four packets of cigarettes, a slightly different story and a cough he’s had for 20 years.

On other occasions, Sam’s a middle-aged person relying on the kindness and empty sofa of a friend, whose homelessness might not be apparent until you ask for an address to send an outpatient appointment letter.

Sometimes Sam is a young woman who shows up to A&E with a plastic bag half-full of stolen menstrual hygiene products, asking me to admit her for a few days because the prospect of another period on the streets is too abysmal.

Sam might be the vulnerable person who has a physical roof over their head but is trapped living with an abusive partner. Less frequently, Sam’s an older person rushed in by ambulance, unresponsive and frozen solid on a park bench. These situations are occurring in hospitals all over the country; the British Medical Association reports that the number of homeless people visiting A&E has nearly trebled in the last seven years. Its data echoes national figures showing that the number of people currently living in the UK without a safe roof over their head has skyrocketed.

There are myriad reasons why someone may find themselves without somewhere to live, but rising rates of poverty and gaping holes in social care provision in the UK are cited as two highly significant contributing factors. Having somewhere to live is a widely recognised social determinant of health, and the healthcare needs of someone who is homeless tend to be different from the general population.

Often the same adverse circumstances that lead to homelessness, such as exposure to adverse events in childhood, also impact health by affecting someone’s biological stress response and physiological mechanisms. This in turn increases the risk of diseases including diabetes and cancers. I see the impact of homelessness on our health system every day; nearly three quarters of homeless people report physical health problems and 80% mental ill-health. Appallingly, the average age of death for a homeless person in the UK is 47 years old.

The UK government introduced the duty to refer as part of the Homelessness Reduction Act towards the end of last year, which means that hospital staff are legally obliged to ask if someone is homeless. We are then obliged to refer someone to the local housing authorities for future support before they are discharged. It’s something, but asking someone if they have somewhere safe to go when they leave hospital is really difficult if we can’t offer an imminently viable solution when the answer is no – Sam can’t sit in our waiting room indefinitely. Different countries have tried different tactics to tackling homelessness; Finland has developed a particularly successful approach to reduce the number of homeless people in Helsinki by providing unconditional housing as a frontline intervention, regardless of other problems.

The rising number of homeless people is having an impact on our NHS and though the introduction of the duty to refer is important, we will never be able to solve the health consequences of homelessness in perpetuity. The old adage of prevention is better than cure persists; homelessness is a political issue that must be addressed with better social care investment and sufficient accessible accommodation. Asking someone if they have somewhere safe to go is a step in the right direction, but it doesn’t solve the problem.

If you would like to contribute to our Blood, sweat and tears series about experiences in healthcare, read our guidelines and get in touch by emailing sarah.johnson@theguardian.com