どっちが与えられるかに気をつけろ happens to be a correct sentence, but it does not mean "Be careful with the one you are provided with". This Japanese sentence rather means "Be careful which will be provided", because どっち means "which one" rather than "the one".
に is a particle that takes a noun, and どっちが与えられるか is a noun phrase (a group of words that works as a noun as a whole) known as an embedded question. Since か can form a noun, ~かに is a perfectly possible combination.
However, what you want to say now is "the one you are provided with", and you don't need an embedded question to express this. You can say 与えられたもの using a simple relative clause.
与えられたものに気をつけろ。
Be careful with the one you're provided with.
By the way, this 気をつけろ implies "the provided thing" is potentially dangerous/harmful. If you just want to say "pay attention", you may want to say ~に目を配れ or ~をよく見ておけ instead.