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.
Jefferson ran for president again in 1800 and won, making John Adams the country's first one-termer. After Jefferson served two terms, each of the next three Presidents was the Secretary of State at the time the previous president left office: Thomas Jefferson's last Secretary of State was John Madison, who was elected president in 1808.