In the U.S., the relevant considerations are governed by some state specific variant of the Model Rules of Professional Conduct.
If two people are adverse, there is a conflict of interest and they cannot be represented by the same lawyer, although some conflicts of interests can be waived. The relevant rules for this analysis are primarily 1.7, 1.8 and 1.9.
The model language of Rule 1.7 about which there is little variation states:
Conflict of Interest: Current Clients
(a) Except as provided in paragraph (b), a lawyer shall not
represent a client if the representation involves a concurrent
conflict of interest. A concurrent conflict of interest exists if:
(1) the representation of one client will be directly adverse to
another client; or
(2) there is a significant risk that the representation of one or more
clients will be materially limited by the lawyer's responsibilities to
another client, a former client or a third person or by a personal
interest of the lawyer.
(b) Notwithstanding the existence of a concurrent conflict of interest
under paragraph (a), a lawyer may represent a client if:
(1) the lawyer reasonably believes that the lawyer will be able to
provide competent and diligent representation to each affected client;
(2) the representation is not prohibited by law;
(3) the representation does not involve the assertion of a claim by
one client against another client represented by the lawyer in the
same litigation or other proceeding before a tribunal; and
(4) each affected client gives informed consent, confirmed in writing.
Rule 1.8 governs specific situations, mostly with the lawyer himself or herself which I omit:
Current Clients: Specific Rules . . .
(b) A lawyer shall not use information relating to representation of
a client to the disadvantage of the client unless the client gives
informed consent, except as permitted or required by these Rules. . .
.
(f) A lawyer shall not accept compensation for representing a client
from one other than the client unless:
(1) the client gives informed consent;
(2) there is no interference with the lawyer's independence of
professional judgment or with the client-lawyer relationship; and
(3) information relating to representation of a client is protected
as required by Rule 1.6.
(g) A lawyer who represents two or more clients shall not participate
in making an aggregate settlement of the claims of or against the
clients, or in a criminal case an aggregated agreement as to guilty or
nolo contendere pleas, unless each client gives informed consent, in a
writing signed by the client. The lawyer's disclosure shall include
the existence and nature of all the claims or pleas involved and of
the participation of each person in the settlement.
Rule 1.9 provides that:
Duties to Former Clients
(a) A lawyer who has formerly represented a client in a matter shall
not thereafter represent another person in the same or a substantially
related matter in which that person's interests are materially adverse
to the interests of the former client unless the former client gives
informed consent, confirmed in writing.
(b) A lawyer shall not knowingly represent a person in the same or a
substantially related matter in which a firm with which the lawyer
formerly was associated had previously represented a client
(1) whose interests are materially adverse to that person; and
(2) about whom the lawyer had acquired information protected by Rules
1.6 and 1.9(c) that is material to the matter; unless the former client gives informed consent, confirmed in writing.
(c) A lawyer who has formerly represented a client in a matter or
whose present or former firm has formerly represented a client in a
matter shall not thereafter:
(1) use information relating to the representation to the disadvantage
of the former client except as these Rules would permit or require
with respect to a client, or when the information has become generally
known; or
(2) reveal information relating to the representation except as these
Rules would permit or require with respect to a client.
With respect to an unrepresented person, outside of litigation, the main limitations are found in Rule 4.1 (truthfulness in statements to others which states: "In the course of representing a client a lawyer shall not knowingly: (a) make a false statement of material fact or law to a third person; or (b) fail to disclose a material fact to a third person when disclosure is necessary to avoid assisting a criminal or fraudulent act by a client, unless disclosure is prohibited by Rule 1.6.),
Rule 4.3 (dealing with unrepresented persons which states "In representing a client, a lawyer shall not communicate about the subject of the representation with a person the lawyer knows to be represented by another lawyer in the matter, unless the lawyer has the consent of the other lawyer or is authorized to do so by law or a court order."), and
Rule 4.4 (respect for the rights of third parties, which states "(a) In representing a client, a lawyer shall not use means that have no substantial purpose other than to embarrass, delay, or burden a third person, or use methods of obtaining evidence that violate the legal rights of such a person. (b) A lawyer who receives a document or electronically stored information relating to the representation of the lawyer's client and knows or reasonably should know that the document or electronically stored information was inadvertently sent shall promptly notify the sender.").