If you’re self-hosted, they are typically stored on the same VM where you’re running Discourse. You can also Configure an S3 compatible object storage provider for uploads. Unless you expect your users to upload videos to Vimeo or whatever there and share that link, there is (mostly?) no way to use those (but there once was? Video Upload to YouTube and Vimeo using Theme Component)
By default, linked images are downloaded to local storage so that they continue to exist even if the source disappears.