Carbon has a large number of stable isotopes. All carbon atoms contain six protons and six electrons, but the different isotopes have different numbers of neutrons. Carbon-14 contains six protons and eight neutrons (8 + 6 = 14).
The amount of carbon-14 in the atmosphere has not changed in thousands of years. Even though it decays into nitrogen, new carbon-14 is always being formed when cosmic rays hit atoms high in the atmosphere.
Plants absorb carbon dioxide from the atmosphere and animals eat plants. This means all living things have radioactive carbon-14 in them. When an organism, eg a tree, dies it stops taking in carbon dioxide. The amount of carbon-14 in the wood decreases with time as it decays into nitrogen with a half-life of about 5700 years. By comparing how much carbon-14 there is in the dead organism with the amount in a living one, the age of the dead organism can be estimated.
The half-life of uranium-238 is 4500 million years. When it decays it forms thorium-234 which is also unstable. Finally, after a series of radioactive isotopes are formed it becomes lead-206, which is stable. The age of the rock can be calculated if the ratio of uranium to lead is known. As the rock gets older the proportion of lead increases. If half of the uranium-238 has turned into lead-206 the rock will be 4500 million years old.