B resets the altimeter to the current Barometric pressure - this of course changes during the flight and ATC should tell you when you tune in, if relevant.
D resets the heading indicator for magnetic Declination, the bearing shown will generally get less and less accurate as the flight progresses owing to the variation in the angle of Magnetic North.
Modern planes have the means to automatically compensate for this, so it is generally only those of us that fly the old crocks that normally have to deal with this. And, of course, once you get above transition altitude, barometric pressure is irrelevant as you are using Flight Levels based on a pre-defined barometric pressure setting.
Generally I reset both each time I am transferred to a new ATC controller, that seems to cover most eventualities. I guess in the real world the first officer, engineer or navigator would have a responsibility for checking and resetting things when necessary.
Best regards,
John