We can measure that the observable atmosphere is mostly hydrogen (more than 80%) and helium (~15%), with a small amount of methane and trace amounts of other molecules, including ethane, acetylene, and several other hydrocarbons.
However, as you go deeper into the planet, the composition must change, as the overall larger bulk density indicates that heavier elements must be present at greater depths. The bulk composition of Uranus and Neptune is roughly only 10–20% hydrogen and helium and 80–90% heavier elements, overall by mass. From our understanding of the fundamental chemical building blocks of the solar system, we can infer that these heavier elements are likely mostly methane, ammonia and water (that form ices), plus some elements that form rocks and metals. However, the relative proportions of the elements (including the ratio of ice to rock) and how they are distributed in the deep interior are unknown.