These are largely just different terms for the same things, but named differently to remind you of some important details. For a rectangle, we usually refer to the length and width; properly, these are the longer side and the shorter side, respectively, but that really makes no difference.
John Adams hated political parties, but he was backed by the Federalists and ran for President as a Federalist and won.   After Adams served, Thomas Jefferson, James Madison James Monroe served two terms each as members of the Democratic Republican party. By this time the Federalist Party all but disappeared.
President Grover Cleveland 24th President. Grover Cleveland, a member of the Democratic Party, took office as the 24th President of the United States on March 4, 1893 at age 55. Cleveland served in office for 4 years and did not seek reelection after his first term.