Why does the Torah place this Parshah here?
Rashi #1: Because when Hakadosh-Baruch-Hu told him to give the B'nos Tz'lofchad their portion of inheritance, he understood that Hashem was instructing him personally to do so, which in turn, implied that He had cancelled the decree prohibiting him from entering Eretz Yisrael. So Hashem disillusioned him by informing him that the decree was still in place.
Rashi: It can be compared to a king who forbade his son to enter the throne-room. When he entered the outer gate, the king followed him; the hall, the king followed him. But when he attempted to enter the throne-room, he told him that from now on, he was forbidden to proceed.
(It is not clear however, why the Parshah appears here and not at the end of Chukas? - See Sifsei Chachamim).
Why did Moshe not carry out Hashem's instructions immediately?
Ramban: Because Hashem did not intend him to. He was merely informing him that he would not be the one to distribute Eretz Yisrael, 1 because he would only merit seeing the land but not entering it. 2