A unidimensional continuous-variable quantum key distribution protocol with untrusted detection is proposed, where the two legitimate partners send unidimensional modulated or Gaussian-modulated coherent states to an untrusted third party, i.e., Charlie, to realize the measurement. Compared with the Gaussian-modulated coherent-state protocols, the unidimensional modulated protocols take the advantage of easy modulation, low cost, and only a small number of random numbers required. Security analysis shows that the proposed protocol cannot just defend all detectors side channels, but also achieve great performance under certain conditions. Specifically, three cases are discussed in detail, including using unidimensional modulated coherent states in Alice’s side, in Bob’s side, and in both sides under realistic conditions, respectively. Under the three conditions, we derive the expressions of the secret key rate and give the optimal gain parameters. It is found that the optimal performance of the protocol is achieved by using unidimensional modulated coherent states in both Alice’s and Bob’s side. The resulting protocol shows the potential for long-distance secure communication using the unidimensional quantum key distribution protocol with simple modulation method and untrusted detection under realistic conditions.