Hi @wendihihihi,
Using WPCode you can create a new PHP snippet and use it as a shortcode.
From the WPCode library inside the plugin install & activate the snippet “Enable Shortcode Execution in Text Widgets” – you can now add the shortcode you created for your snippet in a regular text widget.
More info to help with the above can be found in these 2 articles:
https://wpcode.com/docs/how-to-create-your-first-snippet/
https://www.wpbeginner.com/wp-tutorials/how-to-use-shortcodes-in-your-wordpress-sidebar-widgets/