If you are changing your theme, you likely should generate images in the sizes your theme uses. Three common sizes would be the largest an image is displayed on desktop, tablet, and mobile. There is also going to be the size of image thumbnails.
If you are using a CDN such as Cloudflare, the CDN will take care of this for you. I definitely recommend using a CDN for page caching, and image optimization, and delivering your site as fast as possible.
If you don’t use a CDN, you can make images the sizes your theme uses, easily
WP-CLI
If you have SSH access, use WP-CLI:
wp media regenerate
for the options see:
wp help media regenerate
With a Plugin
https://wordpress.org/plugins/force-regenerate-thumbnails/ is maintained, currently says works with WP 6.7.2