It depends on what kind of sugar, and what kind of salt. All table salt is not just sodium chloride. If you research how it is made, you will see there are other contents. Sea salt is somewhat better. Himalayan salts and other mountain based salts are the best because they are an organic salt that your body can easily absorb.
Refined, white sugar is basically poison. There is no reason for humans to be eating it. Brown sugar is not far behind. Blackstrap molasses, maple syrup, raw and unpasteurized honey, and blue agave are better sugars for your body. They still contain sugar but not as a concentrate, and there are other vitamins and minerals found in those (as long as you don't heat them to high temp).
It's how you obtain sugars and salts that matters more. Nothing in of itself is "bad" for you.