Re: "Icloud not working" "When I log in using my Apple ID, it briefly shows
that I am connected, but then the connection disappears immediately."
We do not know which iOS version you are using on your iPhone:
Below are a few trouble-shooting suggestions :
✽ Keeping an iPhone updated to the newest compatible iOS version often sidesteps issues. You can check for updates in Settings > General > Software updates.
(Please remember to back up your iPhone beforehand, if you choose to update.)
✽ If you have installed any unnecessary third-party (non-Apple) apps like virus-checkers, ad-blockers, cleaners or the like (even VPN) try turning them off (or use uninstallers from their developers) and see if there's any difference.
✽ Also: Any third-party apps that you find necessary, need to be kept up-to-date with the newest version, so they don't cause incompatibility issues.
✽ Browser extensions can also cause issues: see if turning off any can help
✽ Else: Restarting an iPhone can often restore order when something is not working as expected.
_______________________
Re: "Hello Apple Support",
Apple Support is unlikely to see your post to the community. (We are all Apple users, like yourself, doing what we can to help each other troubleshoot issues.)
If needed: iCloud Support have a website online: (There is a "Get Support" link (online chat, phone, eMail etc) at the bottom of their webpage (link below):
iCloud - Official Apple Support