Share battery pack with Arduino and DC motors
It is possible to do what you are asking about, but there are some potential problems.

First, motors generate voltage spikes.  You will want to prevent those from getting into your Arduino and possibly causing damage.  Capacitors are a good start but you should put some additional protection on the power lines like a varistor or TVS to knock the voltage spikes down.

The second issue is the voltage selection.  The Arduino runs on 5V.  Your battery is 6V. Voltage regulators require something called “head room”. This is the minimum voltage above the regulator output voltage.  Depending on the type of regulator, this might be .5V or so, on up to 1.5V.  If the input voltage is not high enough, the regulator won’t work. A 6V battery does not give much head room for a 5V regulator.

A 6V motor will probably work pretty well down around 5V in many applications, as the battery becomes discharged.  The Arduino will stop working well before the motor is the issue. You are likely to find that you don’t get very good battery life before the project stops working unless your 6V battery is very large and your motor does not draw much current.