A pipe that runs through a stud close to the wall surface can be hit by a drywall screw or a nail. In some cases a steel shield plate has to cover it. Change the pipe and the cut and see what an inspector would call.
Pipe material
Stud size
How the pipe passes through
Distance from the pipe to the nearest edge of the stud