丸い is used both circles and spheres/globes, whereas 円い is used only for circles.
That said, when you say まるい, you should almost always go with 丸い. It’s way more common than the 円い writing. (We still teach that 円い is まるい so that you’ll know the reading if you happen to encounter it.)
When referring to a circle, both 丸 and 円 are common. In this usage, 丸 sounds a bit casual and 円 sounds more formal.
丸 can also work as a prefix and mean “full” or “whole.” Here are a few examples for this usage:
丸3日間: for three full [a full three, fully three] days
丸一年: a full [a whole, a good, a solid] year
丸ぼうず: a close-cropped/a close-shaven head (fully cropped/shaved head)
Because of this meaning, there is a vocab such as 丸々.
He put the whole big onigiri into his mouth.
Hope this helps!