Geneva Conventions
The details of applicability are spelled out in Common Articles 2 and 3.

Common Article 2 relating to international armed conflict (IAC): This article states that the Geneva Conventions apply to all the cases of international armed conflict (IAC), where at least one of the warring nations has ratified the Conventions. Primarily:

The Conventions apply to all cases of declared war between signatory nations. This is the original sense of applicability, which predates the 1949 version.
The Conventions apply to all cases of armed conflict between two or more signatory nations. This language was added in 1949 to accommodate situations that have all the characteristics of war without the existence of a formal declaration of war, such as a police action.
The Conventions apply to a signatory nation even if the opposing nation is not a signatory, but only if the opposing nation "accepts and applies the provisions" of the Conventions.
Article 1 of Protocol I further clarifies that armed conflict against colonial domination and foreign occupation also qualifies as an international conflict.
When the criteria of international armed conflict have been met, the full protections of the Conventions are considered to apply.

Common Article 3 relating to non-international armed conflict (NIAC): This article states that the certain minimum rules of war apply to armed conflicts "not of an international character." The International Committee of the Red Cross has explained that this language describes non-international armed conflict (NIAC) "where at least one Party is not a State." For example, it would apply to conflicts between state forces and non-state actors (NSAs), or between two NSAs, or to other conflicts that have all the characteristics of war, whether carried out within the confines of one country or not.
There are two criteria to distinguish non-international armed conflicts from lower forms of violence. The level of violence has to be of certain intensity, for example when the state cannot contain the situation with regular police forces. Also, involved non-state groups need to have a certain level of organization, like a military command structure.
The other Geneva Conventions are not applicable in this situation but only the provisions contained within Article 3, and additionally within the language of Protocol II. The rationale for the limitation is to avoid conflict with the rights of Sovereign States that were not part of the treaties. When the provisions of this article apply, it states that:

Persons taking no active part in the hostilities, including members of armed forces who have laid down their arms and those placed hors de combat by sickness, wounds, detention, or any other cause, shall in all circumstances be treated humanely, without any adverse distinction founded on race, colour, religion or faith, sex, birth or wealth, or any other similar criteria. To this end, the following acts are and shall remain prohibited at any time and in any place whatsoever with respect to the above-mentioned persons:
violence to life and person, in particular murder of all kinds, mutilation, cruel treatment and torture;
taking of hostages;
outrages upon dignity, in particular humiliating and degrading treatment; and
the passing of sentences and the carrying out of executions without previous judgment pronounced by a regularly constituted court, affording all the judicial guarantees which are recognized as indispensable by civilized peoples.
The wounded and sick shall be collected and cared for.
During the negotiation of the Geneva Conventions, France and Britain were initially staunchly opposed to Common Article 3. However, to save face during negotiations and make strategic concessions, France and Britain deliberately introduced ambiguous language in the text of Common Article 3 that made it easy for states to avoid the obligations of the rule. As a consequence, Common Article 3 only concerns with humane treatment and does not deal with methods and means of hostilities, such as bombings committed by non-state armed groups or state forces against civilian targets in the Algerian War and the Troubles.
On February 7, 2002, President Bush adopted the view that Common Article 3 did not protect al Qaeda prisoners because the United States-al Qaeda conflict was "not of an international character." The Supreme Court of the United States invalidated the Bush Administration view of Common Article 3, in Hamdan v. Rumsfeld, by ruling that Common Article Three of the Geneva Conventions applies to detainees in the "War on Terror", and that the Guantanamo military commission process used to try these suspects was in violation of U.S. and international law. In response to Hamdan, Congress passed the Military Commissions Act of 2006, which President Bush signed into law on October 17, 2006. Like the Military Commissions Act of 2006, its successor the Military Commissions Act of 2009 explicitly forbids the invocation of the Geneva Conventions "as a basis for a private right of action."

"... Common Article 3 continues the conventional practice (reflected in both the 'Lieber' and 'The Hague' provisions) of according humanitarian protections only to 'belligerents' who defer to the laws and customs of war: not to 'insurrectionists' who defy these norms from the very outset of hostilities.  Observance of the rules of warfare is what elevates an 'insurrectionist' to the legally cognizable status of 'belligerent' under the 'International law of war'; nothing short of such an 'observance' suffices to effect this transformation from the infra legal to legal."

IAC and/or NIAC classification: Whether the conflict is an IAC or a NIAC or both depends on the nature and circumstances of the situation. Since there is a general prohibition against the use of force between States (as is reflected within article 2(4) of the United Nations Charter) with respect to Common Article 2, it is generally presumed that any use of such military force which is governed by international humanitarian law (IHL) is attributable to deliberate belligerent intent.
Regarding Common Article 3, the ICRC in its 2016 commentary stated the provision includes not just a conflict between territorial government forces and NSAs or NSAs themselves, but also a foreign military intervention against a NSA only if the territorial state consents to such intervention in its territory. Should the intervening country do so without the consent of the territorial state or in support of a NSA against that state, then Common Article 2 applies.
For example, the American-led intervention in the Syrian civil war became both an IAC with Syria and a NIAC with the Islamic State because the U.S. intervened in Syrian territory without the former's consent. On the other hand, Russia intervened in Syrian territory against the Free Syrian Army upon invitation by Syria, making Russia's participation subject only to Common Article 3 and therefore Protocol II (which Russia ratified on September 29, 1989).
The U.S.-led NATO invasion of Afghanistan from October 7 to December 17, 2001 was initially an IAC because it waged war against the Islamic Emirate of Afghanistan under Taliban rule. Once the new Karzai administration was established and recognized internationally, the conflict changed from an IAC to a NIAC, with NATO troops under International Security Assistance Force (ISAF) and Resolute Support Mission (RSM) auspices assisting the Islamic Republic of Afghanistan with its consent in battling Taliban insurgents. In contrast, the Soviet–Afghan War was an IAC because the Soviet Union invaded the Democratic Republic of Afghanistan (DRA) to remove Afghan communist leader Hafizullah Amin from power, then installed puppet leader Babrak Karmal, who "invited" Soviet troops to intervene against the Afghan mujahideen fighters.
While non-state armed groups are automatically presumed to engage in NIACs, they also can cross into the threshold of an IAC. The 2020 ICRC commentary on the Third Geneva Convention requires two elements for this classification: "the group must in fact fight on behalf of that Party" and "that Party must accept both the fighting role of the group and the fact that the fighting is done on its behalf." It further states that "[w]here a Party to a conflict has overall control over the militia, volunteer corps or organized resistance movement that has a fighting function and fights on the State's behalf, a relationship of belonging for the purposes of Article 4A(2) exists." For example, the Viet Cong was under effective control and direction by North Vietnam during the Vietnam War, therefore Common Article 2 solely applied to the conflict.

Enforcement: 

Protecting powers: The term protecting power has a specific meaning under these Conventions. A protecting power is a state that is not taking part in the armed conflict, but that has agreed to look after the interests of a state that is a party to the conflict. The protecting power is a mediator enabling the flow of communication between the parties to the conflict. The protecting power also monitors the implementation of these Conventions, such as by visiting the zone of conflict and prisoners of war. The protecting power must act as an advocate for prisoners, the wounded, and civilians.

Grave breaches: Not all violations of the treaty are treated equally. The most serious crimes are termed grave breaches and provide a legal definition of a war crime. Grave breaches of the Third and Fourth Geneva Conventions include the following acts if committed against a person specifically protected by the conventions: 

willful killing, torture or inhumane treatment, including biological experiments
willfully causing great suffering or serious injury to body or health
compelling a protected person to serve in the armed forces of a hostile power
willfully depriving a protected person of the right to a fair trial if accused of a war crime.