To play YouTube videos in the background while doing other things on your iPhone, you can use YouTube premium or Safari's desktop view mode.
You can download Twitter videos using a third-party app and save them to your desktop or mobile device.