On partial differential and difference equations with symmetries depending on arbitrary functions