Serial usage
For the serial usage, one must avoid combination of cells of different kind and health. They should be as identical as possible.
The best is using
- the same chemistry
- the same format
- the same vendor
- the same brand
- the same lot
- the same aging
Otherwise the cells will have the different capacity and different discharge profiles under the load.
If the serial cell chain is deeply discharged, the "weakest" cell gets discharged completely.
And what is worse, other cells start to electrolyze the unlucky cell in the opposite direction that would be its charging.
This would lead almost inevitably to heavy damage or more likely destruction of the cell, what is unwanted for rechargebles.
Physical destruction with electrolyte leakage is also possible.
For primaries, it would be rather annoyance of not fully used better cells and no easy possibility to find a matching cell.
Parallel usage
It is generally adviced not to use it, unless you know exactly, what you are doing. See also notes for non rechargeable cells below.
Dangers
If cells of different chemistry and therefore voltage range are used in parallel, they overcharge or overdischarge each other when their common voltage does not fit the overlapping of their save voltage ranges.
But even within the overlapping voltage range, cells can be overheated and thermally functionally damaged/destroyed or can even explode, depending on the cell voltage difference and cell internal resistence.
The last paragraph is also valid for cells of the same chemistry. They cannot overcharge each other, but the thermal damage from above applies to them as well.
How to do it well
Only cells of the same chemistry and performance class with about the same actual voltage (check it ) should be connected in parallel.
The voltage difference must respect expected internal resistance and acceptable resulting balancing current. Note that typical internal resistance of Modern AA NiMH cells is $\pu{30-100 m\Omega}$, so $\pu{60 mV}$ difference can cause the current $\pu{1 A}$.
Once connected and balanced, they are safe, as they autobalance themselves during charging and discharging, but consider notes below.
Cell autobalancing of already connected parallel cells
This analysis is aimed for rechargeable cells., supported by Excel simulation.
Cells in an open circurt
Balanced parallel batteries have always the same external (behind their internal resistance ) and internal voltage.
Cells under load
The initial current is in reciprocal ratio of their resistances, so high performance cells would get drained initially faster despite their lower capacity.
The cells with lower $resistance * capacity$ parameter gradually get the internal voltage lover than the others and provide therefore gradually lower current than the other cells.
This leads to the cell balancing, with the current ratio possibly even getting reversed to the initial one. The current ratio slowly converges to the capacity ratio.
Important parameters are the ratio of cell capacities and the ratio of cell internal resistances.
The best results are achieved if these ratios are reciprocal. In such an ideal case, cells are discharging in ratio of their capacities and no internal autobalancing ever occurs.
The good thing is, that the cell resistance increases with the degrading the cell capacity, as cells are aging.
Best autobalancing is achieved on low currents. High currents lead to higher internal voltage disbalance and are more demanding for good cell matching.
If the cell resistance ratio is not optimal for the capacity ratio, autobalancing kicks on, but does not fully compensate. The internal voltages get therefore little disbalanced.
After disconnection, there is ongoing small temporary compensating current.
It is not good to combine lower capacity high performance cells with low resistance with high capacity low performance cells, especially for high loads. As it significantly raises the internal voltage disbalance and after load compensation
Cells under charging
It is generally adviced against parallel charging, as it affects charge stop detection and can cause overcharging of some cells.
That affects serial charging as well.
Non rechargable cells
Parallel connection is not generally good for different . As there can occur small balancing load after disconnection of the powered device.
OTOH, if the identical cells ( like in the serial section) are used in parallel connection all their lifetime, it is not a big deal, as these currents are minimal and short time.