Family unification has been a guiding principle of US immigration since the current law was enacted in 1952. Although numerous attempts have been made to change the immigration laws to give added preference to skilled workers over family unification, those efforts have never been approved. The current law allows US citizens (and in some cases US permanent residents) to sponsor close family members to obtain permanent residence to join them in the US. The law groups these family based applications into 2 groups: (1) Immediate Relatives which include the spouses of US citizens, parents of US citizens at least 21 years of age, and the children of US citizens where the child is under the age of 21 (2) Adult sons and daughters of US citizens 21 or older, siblings of US citizens, and spouses, adult children and minor children of US permanent residents.

These two groups have several critical distinctions:

Immediate Relatives. The law allows an unlimited number of green cards to qualified immediate relatives. Although processing times and other complications can cause applications to stretch into years, this is not the result of waiting periods. Also, immediate relatives who entered the US legally can apply to have their green card applications decided in the US rather than having to go abroad, even if there are many years of unlawful presence or unauthorized employment.
Family members who are not immediate relatives must qualify under one of several preference categories as follows:
FIRST Preference: (FB1) Unmarried Sons and Daughters of U.S. citizens
SECOND Preference
(FB2A) Spouses and Children (under 21) of Permanent Residents
(FB2B) Unmarried Sons and Daughters (over 21) of Permanent Residents
THIRD Preference (FB3) Married Sons and Daughters of U.S. citizens
FOURTH Preference (FB4) Brothers and Sisters of U.S. of adult citizens
There are several things to note about these preferences.

The First, Second, Third and Fourth Preferences allow for “derivative beneficiaries” which means that the spouse and any children under 21 will immigrate along with the primary beneficiary. There are no derivative beneficiaries for Immediate relatives.
Permanent residents can only sponsor a spouse or unmarried children, sons or daughters.The petitioner-family sponsor must first become a US citizen to sponsor a parent, sibling or married son or daughter.

A permanent resident cannot sponsor a married son or daughter. If the sponsored immigrant is single at the time the application is filed and subsequently marries, the application is void on the date of marriage. If the beneficiary later divorces, it does not resuscitate the application and a new application must be filed.
In some cases, a beneficiary can jump from one classification to another without filing a new petition. For example, a single adult son of a US citizen (first preference) will move to the fourth preference if he or she marries.
Finally, and most obviously, the family based preferences do not allow for direct sponsorship of more distant relatives including aunts, uncles, grandparents or grandchildren or cousins.
Not only must non-immediate relatives contend with a waiting period that often stretches into many years, but they must be in the home country or return to their home country for final visa processing if you are out of status (illegal) in the US. This will often trigger a 10-year bar to prevent you from returning to the US if you have been illegal (and acquiring unlawful presence) for more than 1 year. But you may be eligible for a waiver of the 10-year bar while waiting in the US if you are currently residing in the US and can prove extreme hardship to a parent or spouse who is a US citizen or permanent resident.