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.
Grover Cleveland, the only President to ever serve nonconsecutive terms, was the 22nd and 24th President of the United States (1885-89) (1893-97). He was known to be honest, independent, and opposed to corruption and the spoils system. His motto A public office is a public trust, demonstrated his stubborn courage and integrity.