Filter wrap-around to avoid dealing with settling time? Using a Butterworth
If your input waveform is periodic, then wrap-around is appropriate. The most straightforward way to do this is: Initialize the filter state to correspond to an all-zeros input history. Start filtering from the beginning of the input data, writing the output to an output buffer (or in-place to the same buffer, but then the filter has to store its state internally). When the time index runs out of the data buffer, wrap it back to the beginning and keep inputting the filter with zeros for some time while adding the filter's output to successive samples of the output buffer.

You can continue this until the absolute values of the filter's state variables all go under some small threshold value decided by you. This gives an upper limit to residual error in the output. The state of a typical infinite impulse response (IIR) filter is equivalent to (or is directly) its n most recent output values, with n depending on the filter's order. You can keep count of how many of the most recent absolute output values were below the threshold, and when the count reaches n you are done. Or simply decide beforehand how long you will continue, as, for a particular filter, that will determine an upper limit to the residual error proportional to the input.

Note: the period of the input waveform should be an integer multiple of the sampling period.