なにか can mean something as well as somehow while なんだか is always the adverb somehow. なんか is a less formal, more colloquial version of なにか with its に changed to ん (cf. 撥音便)
Although だ should be etymologically the copula, but as you can see in the link, it would be simpler to consider them as independent words on their own.
なんだか悲しい気分だ = なんか悲しい気分だ ...
なんだか is three words なん + だ + か but it's become a set phrase and is used as a word itself pretty much to express an idea like somehow, somewhat, or rather.
It's rather cold today.
なんか is different with a couple of different uses. It's usually an informal version of なにか or など.
I want something cold to drink.