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.
William McKinley served in the U.S. Congress and as governor of Ohio before running for the presidency in 1896. As a longtime champion of protective tariffs, the Republican McKinley ran on a platform of promoting American prosperity and won a landslide victory over Democrat William Jennings Bryan to become the 25th president of the United States.