In brief
Mixed tags affect the element number.
Useful to know
:nth-child() selects by position among the elemental children of one parent. Counting starts at 1 and includes the different types of elements, not just those with the same tag. [1]
If the container starts with h2, followed by three p, the first paragraph is the second child. Therefore, p:nth-child(2) will select it. For counting by type of element there is :nth-of-type(). In alternating rows, consider what happens after adding a title or hidden line: the position selector follows the document structure, not the meaning of the content.
Sources
For further detail and to check the information: