Dynamics-aware Diffusion Models for Planning and Control