Creating filters from the inverse DFT (ifft) is the "Frequency Sampling" method of filter design. Although this is a very intuitive approach once we learn that the coefficients of an FIR filter is the impulse response of the filter, and the Fourier Transform of an impulse response is the frequency response. However such an approach suffers from time domain aliasing (when the ideal impulse response needed exceeds the total memory of the filter; the total number of coefficients). The frequency response (which is a continuous function in frequency) will notably be EXACT to the target magnitude and phase in the frequency domain at all the bin centers of the corresponding DFT, but the time domain aliasing results in an increase in error from the target frequency response for all the frequencies in between the bin centers, and thus will have increased passband ripple and decreased rejection compared to other approaches to filter design.
The Frequency Sampling method of filter design is applicable for applications when our interest is in specific frequencies (such as OFDM) but for any other application where we want a continuous frequency response the results are inferior to other filter design methods such as the optimized algorithms known as Parks-McClellan (equi-ripple) and Least Squares. The Parks-McLellan algorithm which minimizes peak error can be implemented with the MATLAB function firpm and Octave/Python scipy.signal function remez. The Least Squares algorithm which minimizes rms error can be implemented with the firls command in those same tools.
Windowing the samples of an ideal impulse response (as determined from the continuous time Inverse Fourier Transform of a target frequency response; for example a brick-wall filter response would have a Sinc function as the impulse response) can also be very effective, and for this I recommend the Kaiser window as detailed in these other posts:
High Dynamic Range FIR Filters
FIR Filter Design: Window vs Parks McClellan and Least Squares