By Him in whose hand is my soul, if your state of mind remains the same as it is in my presence and you are always occupied with the remembrance of Allah, the angels will shake your hands in your beds and roads. O Hanzalah, rather time should be devoted to this and time should be devoted to that. (Source: Sahih Muslim 2750)
You've only quoted a portion of the full hadith. Reading the full context will help, inshaAllah.
Hanzala Usayyidi, who was amongst the scribes of Allah's Messenger (ﷺ). reported: I met Abu Bakr. He said: Who are you? He (Hanzala) said: Hanzala has turned to be a hypocrite. He (Abu Bakr) said: Hallowed be Allah, what are you saying? Thereupon he said: I say that when we are in the company of Allah's Messenger (ﷺ) we ponder over Hell-Fire and Paradise as if we are seeing them with our very eyes and when we are away from Allah's Messenger (ﷺ) we attend to our wives, our children, our business; most of these things (pertaining to After-life) slip out of our minds. Abu Bakr said: By Allah, I also experience the same.
So I and Abu Bakr went to Allah's Messenger (ﷺ) and said to him: Allah's Messenger, Hanzala has turned to be a hypocrite. Thereupon Allah's Messenger (ﷺ) said: What has happened to you? I said: Allah's Messenger, when we are in your company, we are reminded of Hell-Fire and Paradise as if we are seeing them with our own eyes, but whenever we go away from you and attend to our wives, children and business, much of these things go out of our minds.
Thereupon Allah's Messenger (ﷺ) said: By Him in Whose Hand is my life, if your state of mind remains the same as it is in my presence and you are always busy in remembrance (of Allah), the Angels will shake hands with you in your beds and in your paths but, Hanzala, time should be devoted (to the worldly affairs) and time (should be devoted to prayer and meditation). He (the Holy Prophet) said this thrice. [Sahih Muslim (2750)].
Basically, Hanzalah Al Usaydi was mentioning to the Prophet (ﷺ) how in his presence/Islamic gatherings he does worship and when he returns home.. he is focused on worldly affairs (family, job, etc). Why he pointed this out? - Because he feared the shifting between focus on Akhirah and Dunya was hypocrisy (nifaq).
The Prophet (ﷺ) then clarified that it is not hypocrisy. He told him there is a time/place for everything; a person should do worship/focus on Akhirah (afterlife) and yet also may engage in 'worldly' duties and enjoyments. This is in accordance with Allah's (ﷻ) statement:
"..seek, through that which Allah has given you, the home of the Hereafter; and [yet], do not forget your share of the world. And do good as Allah has done good to you.." [Qur'an (28:77)].
Alhamdulillah. Islam is a religion of moderation.
[Additional note: This actually attests to the great faith of early Muslims, how they feared hypocrisy; yet today we are too caught up with the Dunya (worldly life) without a care :'( Sad.].