Are the functions of ailerons and rudder similar?
Short answer:
Rudder and ailerons have different purposes and control rotation about two different axis. However a rotation about one axis induces a usually unwanted rotation on the other one. In order to rotate exclusively about the desired axis, the other control must be used to cancel the secondary rotation. This is called coordination of controls.
Rudder and ailerons are not the only controls requiring coordination, elevators and throttle actions must be coordinated too, to prevent a change in altitude to result in a change in speed and vice-versa.
The rudder is mostly used to:

Limit yaw movements for safety (Dutch roll) and comfort.
To force the aircraft in a crab (heading not aligned with course), while the weather vaning effect tends to orient the aircraft with the airflow (e.g. for a cross-wind landing).
To force the aircraft to face the airflow when performing a turn. We'll talk about this below.

See Understanding the use of rudder for a more comprehensive explanation.
Ailerons are used to turn, but for a non-small turn an unwanted adverse yaw, opposite to the turn, develops and moves the aircraft away from the airflow (crab), the rudder is used to cancel this crab angle and make the aileron-initiated turn effective.
The availability of a yaw damper relieves the pilot from the duty of coordinating rudder with ailerons in a turn. The yaw damper controls the rudder for stability purposes, and at the same time it maintains the aircraft longitudinal axis into the relative wind without pilot action.

Detailed answer
While it is intuitive to think a turn is triggered by yawing the aircraft and keeping the wing horizontal (like a car), this method is actually ineffective with a rudder of the normal size. The rudder forces the aircraft to change its heading (yaw) but the flight continues more or less in the same direction, the aircraft now moving crabbed. This is specially true as speed and altitude increase and rudder aerodynamic force becomes smaller compared to other factors like inertia.
Banking turns the aircraft
An aircraft is turned by rolling (banking) the wing. When the aircraft spins about the roll axis, the direction of the lift is changed (A/B below). Like any force, the lift vector can be broken down into components (B):

The horizontal component of the lift moves the aircraft away from its original path and the aircraft turns around some point. (Note the vertical component, which still opposes the weight, is now smaller, and a non-small turn also requires adding engine power to maintain altitude.)
However something quite undesirable happens (C): To roll the wing, the upper aileron has to create more lift than the lower one. Lift is created by deflecting the airflow, and this action has a cost: The disturbed airflow creates 'induced' drag. This drag is different from the other drags, it's not due to the friction or the shape of the aileron, but to the deflection of the airflow by the aileron, and increases with the amount of lift created.
Like aileron lift, aileron induced drag is larger on the upper wing, that is on the outer side of the turn. As there is a drag differential, the wing is no more balanced and wants to yaw on the right, opposite to what we want. This force is known as the &quot;adverse yaw&quot;.
A part of the adverse yaw is balanced by the weather vaning tendency of the aircraft, due to the action of the fuselage and the rudder. However this only compensates partially for the yaw. All these forces makes the aircraft turn a bit, but crabbed, as seen in picture D. This situation where the aircraft is not aligned with the airflow is an &quot;uncoordinated turn&quot;, it is very inefficient, slows the aircraft and stresses the airframe.
This is were some action on the rudder is required: The pilot adds some left rudder to completely cancel the adverse yaw created by the ailerons and align the fuselage with the airflow (E). Doing this any slip and skid motion is also minimized. This is known as performing a coordinated turn.
As visible on the figure E, the horizontal component of the lift, the one pulling the aircraft towards the center of the turn, is constantly reoriented in the direction of the center, contrary to the case of the uncoordinated turn (D).
Rolling the wing is a very effective way of turning the aircraft, but needs some rudder correction to account for the induced drag moving the aircraft longitudinal axis away from the airflow direction.
Ailerons deflection reduced in the turn
Note that when the desired bank angle is reached, the pilot reduces the ailerons deflection. The excess of lift and drag on the upper wing decreases too, as does the adverse yaw. The rudder deflection can be reduced too.
Normally the aircraft should maintain its bank and continue to turn with ailerons in neutral position, due to the upper wing flying faster and generating more lift.
However the aircraft in a rolled attitude actually slips into the turn and the dihedral effect tends to decrease the roll angle of the slipping aircraft (roll stability). So some degree of aileron deflection will be maintained.
The ailerons (and the rudder) are used to return the wings to their horizontal position and stop the turn more accurately.

Ailerons-rudder coordination
Coordinating turns is part of the basic training for a student pilot as uncoordinated turns are not only ineffective, they are also unsafe:

Some part of the wing or the controls can be in the shadow of the airflow, meaning they have no useful effect to control the aircraft.
Lateral accelerations develop, the aircraft either slips or skids.

The amount of rudder to apply can be determined using (human senses and) different instruments, including the turn coordinator, aka needle and ball Indicator, which is a sort of level (the ball) usually associated with a bank or rate of turn indicator (the needle). The respective position of the ball and the needle according to different uncoordinated/coordinated situations are like this:

(source)

(source)
When executing a coordinated level turn without wind, at sea level, etc, the radius of the turn and the turn rate depend only on the airspeed and the bank angle:

TAS 150kt, bank 20°: Radius 1,676m, 360° in 2:16.
TAS 300kt, bank 30°: Radius 4,227m, 360° in 3:51.

See this question for additional information.
Yaw damper
In commercial airliners, the yaw control is assisted by one or two yaw damper(s) which function is to increase the yaw stability and prevent the development of the dangerous Dutch roll. Thanks to the yaw dampers, the pilot does not need to use the rudder pedals for coordinated turns.

(source)

Other means of controlling roll/lift
A mean of banking wings directly is required, including when Dutch roll and spin start developing and when flying or rolling with crosswind. But bank control can be obtained by other means than ailerons. While ailerons add lift by changing the camber of the wing,

spoilerons combine spoilers and ailerons, and break lift by disturbing the laminar airflow (B-52),

rudderons combine rudder and ailerons on flying wings (B-2A),

and now bleed air and Coandă effect can bank the aircraft without moving surface (Flaviir project).