They're both primary care so to speak.
So there's overlap, which you've caught on.
In IM you treat patients that need to be in hospital, the really sick (not so sick they need ICU). IM is also mainly focussed more on older populations with multiple comorbidities. there's also more depth to that they need to know as a result. they would also have all the resources a hospital has within their reach. It's great if you like complexity and puzzles, but not so much if you don't like..crumbly elderly patients, because that's bread and butter. Common cases - heart failure, pneumonia (like really bad pneumonia), COPD, functional decline, etc.
versus FM - apart from the obvious (the wide variety of cases of all age groups). Look at it this way - they look after stable patients, well enough to be treated in the community. if you look at pneumonia, if patients require a short course of IV antibiotics, they could get that in the emergency department then go home with a script for orals. get followed up by a FM doc. if the pneumonia's not so severe, an FM doc could just treat with orals, and follow-up (no trip to hospital necessary). if the patient is quite old and frail, they're not necessarily going to bounce back from infections like you would when you're young. bonus points if the patient has multiple comorbidities. then they would go under IM. Also, FM - you work from an office, it doesn't have hospital beds, or the necessary selection of IV drugs and nursing staff to provide care etc etc.
A lot to IM is about discharge planning as well, physiotherapy and occupational therapy, ensuring it's safe for the patient to go home. or if they need transitioning to a nursing home (then they could be referred to geriatrics from there). For FM, it's following up on these things, making referrals when needed.
Long story short:
FM - primarily in the office, out in the community. little of everything. stabler patients and a wider population. when you're young, this may be the only doctor you'll ever see. you must like people/patients, it's a lot of face time with them in clinic.
IM - in the hospital, can do outpatients, but you're looking at sicker patients, often with multiple things going on. greater complexity, requiring greater depth of knowledge in adult medicine. mainly older populations. must like ward rounding and old people. to a degree.
As for residents versus regular doctors lol. you mean attendings versus residents?
at any rate, like what's been said above.
if you're a med student, suffice it to say, when you start rotations, it'll be become more obvious what the differences are to what people do in these fields.