They both do harm to the environment but in different ways.
Disposable diapers use a lot of resources to make such as trees, petroleum and other chemicals. Then fuel is used to ship the diapers to the stores and the packaging that the diapers are in uses other resources such as petroleum to make the plastic or trees to make the cardboard boxes.
Cloth diapers use water and soap to clean as well as electricity to wash and dry them.
With disposable diapers they sit in landfills for 500 years or more before breaking down but with cloth you can reuse them for all your babies and then even pass them down to other babies or use them for cleaning cloths.
If you care about the environment then it's best to use cloth diapers on your baby. Plus you'll be savings thousands of dollars enough to eventually buy your child a used car when they get old enough to drive.