Melt the unsalted butter or heat the olive oil in a medium saucepan over medium heat until shimmering.
Add the finely chopped yellow onion and cook, stirring occasionally, until translucent, about 3–5 minutes.
Stir in the minced garlic and cook until fragrant, about 1 minute.
Add the long-grain white rice and toast by stirring for 1–2 minutes until grains look slightly opaque.
Pour in the chicken or vegetable broth, then season with salt, black pepper, and dried parsley (if using); stir to combine.
Bring to a rolling boil over medium-high heat, then reduce heat to low, cover tightly, and simmer undisturbed for 15 minutes.
Remove from heat and let rest, covered, for 5–10 minutes to allow steam to finish cooking the rice.
Uncover and fluff with a fork; serve warm as a savory side dish.