Dim chords can be thought of as dominant chords. D#dim7 works as a substitute for a B7 chord (as well as D7, F7 and Ab7). Try it - substitute any dominant seventh with a dim7 that's based on the dominant's third (or seventh). To find a suitable dim7 for leading to a D major, you want to substitute D's dominant i.e. A7. The third of A7 is C#, so --> C#dim7. Try G > Em > C#dim7 > D for your second example. Or e.g. G > Em > Edim7 > D. Or you can put the bass there too G > Em > C#dim7/A > D.
For a circle of fifths, try:
Edim7/C > Ebdim7/F > Ddim7/Bb > Dbdim7/Eb > Cdim7/Ab > Bdim7/Db > ... etc.
To answer your question, why D#dim7 doesn't work in leading to D, it's because none of the four dominants that can be substituted with a D#dim7 is A7 that would lead to D in a V->I fashion. The four dominants that can be substituted with a D#dim7 are B7 (leading to E), D7 (leading to G), F7 (leading to Bb) and Ab7 (leading to Db).
Try these:
- D#dim7 > E
- D#dim7 > G
- D#dim7 > Bb
- D#dim7 > Db
Or their minor variations:
- D#dim7 > Em
- D#dim7 > Gm
- D#dim7 > Bbm
- D#dim7 > Dbm
Someone downvoted this, maybe they don't like to think of dim chords as dominants. :) But this is a very powerful way of handling dim chords, because it makes their identification and function easy to see, as long as you know how the most basic V-I i.e. dominant-tonic motion works. On the guitar you only have to locate the third (or seventh) of a dominant seventh (or secondary dominant or whatever you're doing) and play_any_ dim7 that includes that note (because dim7s are symmetric). This is a nice trick in soloing. Whenever there's a V-I motion: find the dominant's third and place a dim7 arpeggio pattern that has that note. For example in a G7 - C motion, outline a Bdim7 chord on top of the G7.
The same principle can be applied in this situation: How to choose between Cdim and C#dim?
(Good and useful answers are downvoted, and the most upvoted answer doesn't really even answer the question. Someone here has a problem with dim chords?)