Custom post type slug 404

You are missing with_front in rewrite which is true by default. Change it to something like this

'rewrite' => array(
    'slug'          => 'apps',
    'with_front'    => false,
)

See the docs

💡 Bonus tip: You should avoid using flush_rewrite_rules() there, it’s quite heavy and affects performance. You should ONLY use it when modifying rewrite_rules outside of register_post_type(), usually in plugin or theme activation/deactivation hooks.