@SurabhiAc3 here is the link on how to use dynamic media assets on EDS document based authoring scenarios
https://experienceleague.adobe.com/en/docs/experience-manager-learn/sites/document-authoring/how-to/...
But however it's recommended to use EDS image optimization features which already optimize image based on browser type, resolution until unless you want to use specific smartcrop from existing DM asset.
If you decided to use DM asset, Also please make sure to use same CDN domain for DM assets as of page CDN to reduce latency around SSL calls as EDS is designed to be page performance specific, it may slowdown image loads a bit.