iPhone’s PiP mode is only available on iOS 14 and later. You can enable it by heading to Settings > General > Picture in Picture and toggling on “Start PiP Automatically.”
Then, launch a PiP-supported app, play your video, and tap the PiP icon on the video. You can now drag your video’s floating window and place it wherever you want on your screen.
Also, all web browsers support PiP mode, so you can use the feature while playing a video on a site. You can use this method for YouTube since the platform’s official app doesn’t support PiP mode without the Premium subscription on the iPhone.