This is a normal command after what is mentioned before, because what Allah (swt) has given to His Messenger necessitates that it be responded to by thanking.
فَصَلِّ (So pray): The Messenger is being told to be consistent in prayer and be thankful for the sake of his Master due to the abundant and the blessings that He (swt) has given to him. This is the least that you may do in return.
وَانْحَرْ (sacrifice): Indicates spending. That is, as Allah (swt) has bestowed you with blessings, so you have to give others. Allah (swt) says:
﴾وَآتُوهُم مِّن مَّالِ اللَّهِ الَّذِي آتَاكُمْ﴿
(…and give them from the wealth of Allah which He has given you..) (An-Nour: 33)
﴾وَأَحْسِن كَمَا أَحْسَنَ اللَّهُ إِلَيْكَ ﴿
(And do good as Allah has done good to you.) (Al-Qassass: 77)
The Messenger of Allah (swt) said:
“Allah helps His slave as long as he helps his brother.”
Some people say: I have accustomed to give the people, so Allah let me accustomed to His grants, thus I do not want to stop my grants so that Allah (swt) would not stop His to me.
The scholars have two opinions about interpreting this verse:
Some of them said: It refers to the prayer and sacrifice in general; that is, slaughter animals and distribute them to the poor.
Others said: It means slaughter of the animals on Eid al Adha. But this opinion may limit a wide meaning because the relationship between the Messenger of Allah (saws) and His Lord is not bounded, so that the prayer cannot be limited to just the prayer of Eid. The Messenger (saws) has been raised to the praiseworthy and nearness position, which is one of the characteristics of the Messenger (saws).
Accordingly, we may say that the prayer and the sacrifice meant in this verse are absolute, and as Allah (swt) has granted His Messenger (saws) Al-Khawthar, which is unlimited favour, then the prayer is unbounded and the bestowments should not be limited as well.
 Sahih Muslim, hadith No. 2699