Tube with variable section
Here is a (destructive) way to do it:

Create a 8 vertex square, array it (Constant Offset mode) and make it follow a curve:



Apply the modifiers, select each square and round it more and more with AltShiftS (To Sphere) and playing with the Operator box factor:



Switch to Edge Select mode, select all and right click &gt; Bridge Edge Loops:



In the Operator box, play with the Number of Cuts value: