What is it you’re trying to accomplish? There may be another way.
@heydarmohseni – yes if you can mention the use case in detail which explains what you are trying to achieve then that would enable others to help you in a better way.
I assume you are trying to target WordPress widget with unique CSS identifier. WordPress by default assigns css class to a widget. However if you need more css classes or unique ID that you can control then this plugin might be helpful – https://ww.wp.xz.cn/plugins/widget-css-classes/
Still, we would love to know more on what you are trying to achieve.