By default, Audacity uses the SoundTouch library for the Change Pitch (changing pitch without changing tempo) and Change Tempo (changing tempo without changing pitch) effects. These are known as Time Stretching effects, because they defy the normal expectation that reducing the speed of the audio (thus increasing its length) will lower the pitch and vice versa. Inevitably, some audible artifacts will be heard after applying these effects, particularly at more extreme settings.
Also, due to weaknesses in the algorithm, Change Pitch does not keep the length *exactly* as before. When increasing pitch, the processed audio tends to be reduced in length very slightly. When reducing pitch, a little trailing silence is added at the end. This can make Change Pitch unsuitable for changing the pitch of individual very short notes. In a similar way, Change Tempo can remove a very short length of content from the start or end of the selection, or not stretch the end of the content to the end of the selection when slowing down. Both of these symptoms may leave a short silence at the end of the resultant selection.
These effects also have a "High Quality" option, and an alternative time stretch effect called Sliding Time Scale/Pitch Shift. These use an alternative time stretching library known as "Subband Sinusoidal Modeling" (SBSMS). Sliding Time Scale / Pitch Shift allows you to change tempo (without changing pitch) while simultaneously changing pitch (without changing tempo). It can also set a different tempo or pitch change value for the start and end of the audio. Artifacts are still expected at more extreme settings, although no length changes arise from changing pitch, and changing tempo should not result in removed content or silences at the end of the selection. Note: this effect is several times slower than SoundTouch.
For percussive type sounds, the SoundTouch library may sound echoey, in which case the SBSMS library will probably be a better choice. For "pad" sounds that have a more gradual start and stop, the SoundTouch library may sound subjectively better, particularly for larger stretch ratios.