Is it "John or Mary's house" or "John's or Mary's house"?
Solution 1:
In my view, this question has three dimensions—one focused on logic, one concerned with style-guide preferences, and one emphasizing real-world usage.
The logic dimension
As a matter of logic, the answer in this exchange:
"Who ate the pie I left on the table to cool?"
"John's or Mary's dog."
has less ambiguity than the answer in this exchange:
"Who ate the pie I left on the table to cool?"
"John or Mary's dog."
In the first exchange, a listener may be in doubt as to whether both John and Mary have dogs, one of which ate the pie, or whether they have between them a single dog but the speaker is uncertain who the actual owner is.
In the second exchange, a listener may have the same doubt on that score, but in addition he or she may have doubt about whether the speaker is indicating that the two primary suspects are John and a dog that Mary owns.
Of course, a similar ambiguity lurks in this exchange:
"Who ate the pie I left on the table to cool?"
"John and Mary's dog."
which may indicate joint ownership by John and Mary of a pie-eating dog or joint eatership of the pie by John and a dog that Mary owns.
So logically, it would seem clearer in some instances to use this form of expression:
"Who ate the pie I left on the table to cool?"
"John's and Mary's dog."
Nevertheless, usage doesn't require that form.
The style-guide dimension
Several style guides weigh in on joint possessives and reach essentially the same conclusion. From The Oxford Guide to Style (2002):
Use 's after the last noun of a set of linked nouns sharing 'possession':
[Examples:] Liddell and Scott's Greek–English Lexicon, Beaumont and Fletcher's comedies, Auden and Isherwood's collaborations
but repeat 's after each noun in the set when the 'possession' is not shared:
[Examples:] Johnson's and Webster's lexicography, Shakespeare's and Jonson's comedies, Auden's and Isherwood's temperaments
From The Chicago Manual of Style, sixteenth edition (2010)
7.22 Joint versus separate possession Closely linked nouns are considered a single unit in forming the possessive when the thing being "possessed" is the same for both; only the second element takes the possessive form.
[Examples:] my aunt and uncle's house[,] Gilbert and Sullivan's Iolanthe[,] Minneapolis and Saint Paul's transportation system
When the things possessed are discrete, both nouns take the possessive form.
[Examples:] my aunt's and uncle's medical profiles[,] Dylan's and Jagger's hairlines[,] New York's and Chicago's transportation systems[,]Gilbert's and Sullivan's mustache
Bryan Garner, Garner's Modern American Usage, second edition (2003) even uses the example of "John and Mary's house" in spelling out the same guideline:
POSSESSIVES. ... E. Joint Possessives. For joint possession, an apostrophe goes with the last element in a series of names. If you put an apostrophe with each element, you signal individual possession. E.g.:
John and Mary's house (Joint.)
John's and Mary's houses (Individual.)
America and England's interests. (Joint.)
America's and England's interests.
Other style guides line up similarly, although Theodore Bernstein, The Careful Writer (1973) argues that 's is appropriate after each possessor noun is appropriate whether possession is joint or individual:
When it is desired to indicate the possessive case for two coordinate nouns, each takes "'s" in written prose—John's and Jane's love affair—although in spoken language it is common practice to indicate the possessive only for the second noun—John and Jane's love affair.
Evidently, either style preferences have change since 1973 or Bernstein was engaging in wishful thinking bout how the love affair between John and Jane would normally appear in written prose.
None of the guides I consulted offered explicit examples involving an X or Y possessive situation, rather than an X and Y possessive situation—and at first look, that may seem an odd or unfortunate omission. But Oxford, Chicago, and Garner make clear that the the determining factor in the rule they enunciate is the issue of joint possession versus individual possession.
The situation that the poster asks about is explicitly one in which John and Mary do not jointly possess the house in question. It follows that the rule for individual possession—repeat the 's for each potential possessor noun—applies. The conjunction used is exclusive (or) rather than inclusive (and), but that reinforces the fact that the house is not a joint possession of the two named people.
The usage dimension
I ran Google books searches for "John's or Mary's" and "John or Mary's" and found that the former is much more common than the latter. "John's or Mary's" turns up in dozens of books, but "John or Mary's" appears in only three.
From Phronesis: A Journal for Ancient Philosophy (1982) [combined snippets]:
For example, John's indignation with Mary involves John making a judgment of Mary's unmerited good fortune (ibid, 1386b10) which thereby precludes John making the judgment of Mary's undeserved misfortune (ibid, 1385bl4) that he would have made were he roused to pity her. Again, Mary's envy of John involves, for example, Mary making a judgment of reproach concerning herself through John's successes (ibid, 1388a17) which thereby precludes Mary making a Judgment of John's undeserved misfortune that she would have made were she roused to pity him (ibid, 1385b 14). This is not a matter of insincerity on John or Mary's part.
From Janice Fox & J. Timothy Maximoff, "Annual Exclusion: Save Money by 'Gifting' It Away" in the Silicon Valley Business Journal (January 17, 1999), cited in Stanley Peters & Dag Westerståhl, Quantifiers in Language and Logic (2006):
Let's take a look at a hypothetical Silicon Valley family. John and Mary Tax-reducer have a combined estate worth $3 million, two married children and four young grandchildren in private schools. Mary's mother has health problems that are not covered by insurance and needs financial help. John and Mary's estate plan uses both of their lifetime unified credits. Even so, roughly $720,000 of estate tax will be payable upon their deaths. Assuming the value of their estate will increase, this tax will also increase.
...
If the Tax-reducer's stock were expected to appreciate substantially, John and Mary could give their children stock instead of cash. This eliminates the estate tax on the appreciation of the stock at their deaths. However, there is a trade-off in making gifts of appreciated property: If Mary and John give shares of stock to their children, the children's cost basis for purposes of calculating capital gains will be the same as John and Mary's basis.
...
Although gift tax returns are not required for annual exclusion gifts, John and Mary may want to file gift tax returns. This will start the three-year time period within which the IRS can audit the return and question the valuation. If no gift tax returns are filed, the IRS could question the valuation and assess estate or gift tax when reviewing John or Mary's estates after their deaths.
And from Izabela Schultz & E. Sally Rogers, Work Accommodation and Retention in Mental Health (2010):
Over 45% of the participants considered that people with a problem like John or Mary's are unpredictable. Employees at the three levels did not differ in this regard. However, differences between the levels of employees were found in three stigmatizing attitudes. Compared to others, managers were more likely to endorse "I would not vote for a politician if I knew they suffered a problem like John or Mary's" (45.0% vs. 38.9% for supervisors, 36.2% for ordinary workers); "I would not employ someone if I knew they had a problem like John or Mary's" (30.0% vs. 15.7% for supervisors, 18.9% for ordinary workers); and "f I had a problem like John or Mary's I would not tell anyone" (17.2% vs. 9.6% for supervisors, 12.0% for ordinary workers).
The authoritative of the Silicon Valley Business Journal's repeated use of "John or Mary's" is somewhat undercut by its use of "[t]he Tax-reducer's" as the plurals for of the made-up surname Tax-reducer (the normal form would be "the Tax-reducers'"). But the larger points here are that (1) people do use both "John's or Mary's" and "John or Mary's" as linked possessives, and (2) that "John's or Mary's" is far more common in the Google Books database than "John or Mary's" is.
Conclusion
Logic, prevailing style rules, and predominant real-world usage support the notion that the form "John's or Mary's house" is preferable to "John or Mary's house." However, both forms do occur in published (and presumably copyedited) writing—and it seems extremely likely that "John or Mary's" is far more common in spoken English, where style rules carry relatively little weight, than in published English, where editors tend to interfere with authors' personal inclinations on points such as this one when they differ from the publishing house's style rules.
Because possessive forms are as subject to idiomatic usage choices as other forms of speech and writing are, the choice of "John's or Mary's" versus "John or Mary's" the usage argument in favor of "John's or Mary's" seems far more relevant than the logical argument. Either choice—except in odd instances involving surreptitiously eaten pies (for example)—will be equally coherent to hearers or readers without further clarification.
Solution 2:
My solution. “The house of John or that of Mary” can be rewritten as
John's house or Mary's
Under the subheading compounds with pronouns, Wikipedia suggests a similar word order when comparing the success of two novels
Was She's success greater, or King Solomon’s Mines's?
Likewise, the OP's real concern: "the Social Worker['s] or Attorney's employee identification card." I'd use either of the following.
"…the Social Worker’s employee identification card or the Attorney’s."
OR
"…the Social Worker's or Attorney’s employee identification card.
The social worker and the attorney each has an employee ID card, it seems sensible that each separate noun phrase has their own apostrophe.
EDIT
I've looked for resources to support my suggestion, really I have but I didn't find any, so I'm left with a couple of real-life examples.
- But better than Tom's house, or Bob's, or even Bill's was the old Swann place...
- Many dispute whether it is Shakespeare’s play or Marlowe’s that holds the anti-semitic tones. (link)