Everyone probably heard at some point in their career that "Util packages are bad", "Don't use util modules!", or "Utils are an anti-pattern".
The problem with these statements is that they are living on the "extremes"; and extremes in programming are the real anti-pattern.
When senior developers talk about utils being bad they refer to util packages that are global to the project. Code that is accessible from everywhere in the code base, can lead to code organizational issues, maintaining or refactoring this code is hard.
Project-level util packages resolve concepts that are too broad for the project. What code do you put inside these packages? String manipulation functions? File handling helpers? Parsing request variables? The list could go on.
Package-level utils, on the other hand, are perfectly fine to write, for example, having some entities/models/structs that describe a product and the util functions that parse or manipulate the name of the product.
Ideally, these utils shouldn't be used outside the package where they were defined, but other internal packages could use these to parse a product's name.
So yes, utility functions are useful if their scope is well defined.
Cover photo by PIRO4D