How to filter url on post submission?

image_send_to_editor hook will handle when the image is sent to the editor. The problem will be that your editor may not work correctly when you modify the URL — use with caution.

save_post will allow you to modify the $post content on save.

update_(meta_type)_metadata could be used to intercept when the meta data is saved.