The consonant sounds in "did" and "ted" are both made by putting our tongue right behind our top teeth and then moving it to release a small puff of air.
If we make these sounds the same way, then what is the difference between them? The difference is not what we do with our mouths, but what we do with our voice. When we make a /t/ sound, we do not use our voice; the sound is quiet. Put your hand on your throat and make the sound /t/. You should not feel any movement in your throat.
However, when we make a /d/ sound, we do use our voice. Put your hand on your throat and make the /d/ sound. Can you feel the vibrations?
Another way to help you learn the difference between these two sounds is that /t/(the voiceless sound) makes a bigger puff of air. Put your hand in front of your mouth and make the /t/ sound. Feel the big puff of air. Now put your hand in front of your mouth again and make the /d/ sound (the voiced sound). Feel only a little puff of air? Good!