兹 as a phonetic component
商甲鐵178.2合集11606西周金沈子它簋蓋集成4330篆部・說文解字隸定　

The character was originally「」, largely used as a phonetic loan for Zhengzhang OC: /*ʔsɯ/, meaning this (now written as「茲」).「」came from a variant way of writing「絲」(/*slɯ/, silk).



Later on,  horizontal lines or「Ｕ」shapes as differentiating marks were added to the top portion of「」, just below the notches, possibly to differentiate the original character from a myriad of other uses in the Zhou period (proper nouns and other phonetic loans). These additions ambiguously formed what is now written as「玆」or「茲」, which are really just variant shapes of each other:

東周・秦石鼓　篆玄部・玆說文解字隸定　

戰國・楚簡・帛緇衣・13郭店楚簡篆艸部・茲說文解字隸定　

Some other readings associated with「」or「玆」to note:


Reading「」as「幽」(concealed > dark) is either an erroneous interpretation of「」as the phonetic component of「幽」, or saying that originally「」had another pronunciation.
Reading「玆」as black should be a phonetic loan for「緇」(/*ʔsrɯ/, black silk).
Reading「玆」as「玄」(/*ɡʷeːn/, black, dark) is the association of「玄」with「玆」. In this sense,「玆」can be viewed as another character, formed by reduplicating「玄」to also represent /*ɡʷeːn/, and unrelated in sound etymology to /*ʔsrɯ/.




Continuing on for the morpheme /*ʔsɯ/ (this), the two「亠」on top of「玆」were sometimes joined to form「䒑」:

秦簡為吏之道51睡虎地秦簡隸定　


  Alternatively,「䒑」is also a brush calligraphy variation of「艹」. Today, several character variations are due to swapping「艹」with「䒑」or vice-versa, the most prominent being「著」and「着」which were both originally corrupted from「箸」.




The character development timeline should then be「」,「玆・茲」,「兹」. Although this cannot directly answer the question as to why sometimes「茲」is preferred over「玆」or vice-versa as a phonetic component, from the historical development it is possible to see that the facts behind character structure and development was very concealed to later writers, influencing the muddled choices.

If you really had to choose one component or the other out of「茲」or「玆」, then pending on the character, that choice is sometimes quite easy.「茲」is defined in Shuowen as


  艸木多益


while「玆」is defined as


  黑也


So, for a character like「滋」which is defined as


  益也


The obvious choice is「茲」.



References:


季旭昇《說文新證》
黃德寬《古文字譜系疏證》
小學堂
國學大師


郭沫若《甲骨文合集》
中國社會科學院考古研究所《殷周金文集成》

中國哲學書電子化計劃


宋・徐鉉等奉敕校定　漢・許慎《說文解字》