Yes, it is important that you select the correct Video codec and the correct Output muxer. If you get those wrong, strange things can happen when you try to play the video in Windows Media Player for example. Some players such as VLC, have very good error correction, so you may not see any anomalies during playback, but rest assured, you are bound to experience poor playback at some stage if you have the codec and muxer wrong.
For .mp4, you always want to select the x264 and AAC (FDK or lav) audio codecs along with the MP4 Muxer. These are the only fully supported codecs to use for .mp4 and the MP4 specification actually tells you that. Some encoders/players allow mixing and matching of codecs, but that is generally not supported by the MP4 specification.
If you leave the Video Output set to copy (which you should do when adding multiple .mp4 clips together), then it does just that and it will copy the Video into a new container using the MP4 Muxer. Likewise for Audio.
For .mkv, you may select any of the video or audio codecs, but they are not guaranteed to work with your video playback software or device. It is usually best to select HEVC (x265) and AC3 (lav or Aften) Audio along with the MKV Muxer for .mkv files since these are the most supported codecs for .mkv.